Feat: Automate release process (#3603)

* Update

* Feat: Automate release process
This commit is contained in:
Luis Padron 2021-10-28 13:44:04 -04:00 committed by GitHub
parent 46c47301d1
commit 31f22c3c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 16 deletions

57
.github/workflows/release.yml vendored Normal file
View File

@ -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="(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?: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<buildmetadata>[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

View File

@ -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

View File

@ -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`

View File

@ -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)

View File

@ -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"
)