diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..87788a188 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Tuist Release + +on: + workflow_dispatch: + inputs: + version: + description: Version for the release (ex. x.x.x) + required: true + title: + description: Title for the release (ex. Chimera) + required: true + +env: + RUBY_VERSION: '3.0.2' + TUIST_STATS_OPT_OUT: true + +jobs: + release: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + - uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-${{ env.RUBY_VERSION }}-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-${{ env.RUBY_VERSION }}-gems- + - name: Bundle install + run: | + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: Update Tuist version + # This step updates the version in the Constants.swift file by replacing the current tag in Constants.swift with the tagged release. + # This step also updates the CHANGELOG.md to rename the Next section to the proper release version. + # We use a Regex from https://semver.org/ to replace the current version with the new one + run: | + VERSION_REGEX="(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" + perl -pi -e 's/version = \"${ VERSION_REGEX }\"/version = \"${{ github.event.inputs.title }}\"/g' Sources/TuistSupport/Constants.swift + sed -i '' -e "s/## Next/## ${{ github.event.inputs.version }} - ${{ github.event.inputs.title }}\"/g" CHANGELOG.md + - name: Fourier releae + run: ./fourier release tuist ${{ github.event.inputs.version }} + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GH_RELEASE_TOKEN }} + files: build/* + name: ${{ github.event.inputs.version }} - ${{ github.event.inputs.title }} + tag_name: ${{ github.event.inputs.version }} + - name: Commit CHANGELOG and Constants update + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "[CI] Update CHANGELOG and version for release ${{ github.event.inputs.version }}" + branch: main + file_pattern: CHANGELOG.md Sources/TuistSupport/Constants.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 364088051..ebd40a331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ - Schemes can be hidden from the dropdown menu `Scheme(hidden: true)` [#3598](https://github.com/tuist/tuist/pull/3598) by [@pepibumur](https://github.com/pepibumur) - Sort schemes alphabetically by default [#3598](https://github.com/tuist/tuist/pull/3598) by [@pepibumur](https://github.com/pepibumur) +- Add automation to release [#3603](https://github.com/tuist/tuist/pull/3603/) by [@luispadron](https://github.com/luispadron) ## 2.1.1 - Patenipat diff --git a/RELEASE.md b/RELEASE.md index 27924cd1b..993e98206 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,16 +2,14 @@ This document describes the process of releasing new versions of tuist. -1. First make sure you are in main and the latest changes are pulled: `git checkout main && git pull origin main` -2. Determine the new version: - -- Major if there's been a breaking change. -- Minor by default. -- Patch if it's a hotfix release. - -3. Update the version in the `Constants.swift` file. -4. Update the `CHANGELOG.md` to include the version section. -5. Commit the changes and tag the commit with the version `git tag x.y.z`. -6. Build tuist artifacts by running `./fourier release tuist x.y.z`. -7. Create a release on GitHub with the version as a title, the body from the CHANGELOG file, and attach the artifacts in the `build/` directory. -8. Run `tuist update` and verify that the new version is installed and runs. +1. Determine the new version: + - Major if there's been a breaking change (`+.x.x`). + - Minor by default (`x.+.x`). + - Patch if it's a hotfix release (`x.x.+`). + - Reach out to the core team if you have questions. +2. Go to the Actions tab in GitHub +3. Select the "Tuist Release" action +4. Select Run Workflow +5. Input the version from #1 into the action prompt and provide a title +6. Run the workflow +7. Wait for the workflow to run and succeed and verify with `tuist update` diff --git a/projects/fourier/lib/fourier/commands/release.rb b/projects/fourier/lib/fourier/commands/release.rb index 1e21fd40f..ba6773eb2 100644 --- a/projects/fourier/lib/fourier/commands/release.rb +++ b/projects/fourier/lib/fourier/commands/release.rb @@ -5,8 +5,6 @@ module Fourier class Release < Base desc "tuist VERSION", "Bundles and uploads Tuist to GCS" def tuist(version) - Utilities::Secrets.decrypt - output_directory ||= File.expand_path("build", Constants::ROOT_DIRECTORY) Services::Bundle::Tuist.call(output_directory: output_directory) Services::Bundle::Tuistenv.call(output_directory: output_directory) diff --git a/projects/fourier/lib/fourier/utilities/swift_package_manager.rb b/projects/fourier/lib/fourier/utilities/swift_package_manager.rb index f48c3df4f..36f45d4d0 100644 --- a/projects/fourier/lib/fourier/utilities/swift_package_manager.rb +++ b/projects/fourier/lib/fourier/utilities/swift_package_manager.rb @@ -24,7 +24,6 @@ module Fourier "-destination", "platform=macosx", "BUILD_LIBRARY_FOR_DISTRIBUTION=YES", "ARCHS=arm64 x86_64", - "EXCLUDED_ARCHS=", "BUILD_DIR=#{swift_build_directory}", "clean", "build" )