RTTuist Release #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: RTTuist Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Custom version for the release (ex. x.x.x), if not specified, next minor. | |
required: false | |
publish: | |
description: Should publish? | |
required: false | |
type: boolean | |
default: true | |
env: | |
RUBY_VERSION: '3.0.3' | |
TUIST_STATS_OPT_OUT: true | |
TUIST_INCLUDE_TUIST_CLOUD: "1" | |
permissions: | |
contents: write | |
pull-requests: read | |
statuses: write | |
jobs: | |
prepare-release: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.semvers.outputs.version }} | |
changelog: ${{ steps.changelog.outputs.changelog }} | |
commit_hash: ${{ steps.auto-commit-action.outputs.commit_hash }} | |
environment: Release | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
- name: 'Get next minor version' | |
if: ${{ github.event.inputs.version == '' }} | |
id: calculated_semvers | |
uses: "WyriHaximus/github-action-next-semvers@v1" | |
with: | |
version: ${{ steps.previoustag.outputs.tag }} | |
- name: 'Set version' | |
run: echo '::set-output name=version::${{ steps.calculated_semvers.outputs.minor }}${{ github.event.inputs.version }}' | |
id: semvers | |
- 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. | |
run: | | |
sed -i -e "s/version = \".*\"/version = \"${{ steps.semvers.outputs.version }}\"/g" Sources/TuistSupport/Constants.swift | |
- name: "Build Changelog" | |
id: changelog | |
uses: mikepenz/release-changelog-builder-action@v2 | |
with: | |
configuration: ".github/workflows/changelog-configuration.json" | |
toTag: "main" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update Changelog | |
uses: stefanzweifel/changelog-updater-action@v1 | |
with: | |
latest-version: ${{ steps.semvers.outputs.version }} | |
release-notes: ${{ steps.changelog.outputs.changelog }} | |
- name: Commit | |
id: auto-commit-action | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: ${{ github.event.inputs.publish == 'true' }} | |
with: | |
commit_message: "[Release] Tuist ${{ steps.semvers.outputs.version }}" | |
release: | |
runs-on: macos-13 | |
needs: prepare-release | |
environment: Release | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.prepare-release.outputs.commit_hash }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
repository: tuist/TuistCloud | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: TuistCloud | |
fetch-depth: 0 | |
- name: Up workspace | |
if: ${{ github.event.inputs.publish == 'true' }} | |
run: make workspace/up | |
- name: Build artifacts | |
if: ${{ github.event.inputs.publish == 'true' }} | |
run: ./make/tasks/workspace/release/bundle.sh | |
- name: Create GitHub Release | |
if: ${{ github.event.inputs.publish == 'true' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: build/* | |
name: ${{ needs.prepare-release.outputs.version }} | |
tag_name: ${{ needs.prepare-release.outputs.version }} | |
body: ${{ needs.prepare-release.outputs.changelog }} | |
target_commitish: ${{ needs.prepare-release.outputs.commit_hash }} |