release #8
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
# This workflow must be triggered manually. It is intended to be an entrypoint for | |
# the whole release process. See the docs/internal/release.md for more details. | |
name: release | |
on: | |
workflow_dispatch: | |
# It's technically possible to run several releases in parallel if they are | |
# a regular release and a hotfix from a different branch, but let's try not | |
# to do that for our own sanity (🦶🔫). | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Unfortunatelly, we can't use the default `github.token` in this workflow. | |
# By design, GitHub doesn't trigger workflows on pushes to tags created by | |
# the `github.token` to prevent infinite loops. | |
# https://github.com/orgs/community/discussions/27028 | |
token: ${{ secrets.RELEASE_GITHUB_PAT }} | |
- name: Resolve the release version | |
run: echo "release_version=$(scripts/release/get-version-from-changelog.sh)" >> $GITHUB_ENV | |
- name: Resolve the next dev version | |
run: echo "next_dev_version=$(scripts/release/get-next-dev-version.sh ${{ env.release_version }})" >> $GITHUB_ENV | |
- name: Resolve the git tags | |
run: echo "tags=$(scripts/release/get-git-tags.sh ${{ env.release_version }})" >> $GITHUB_ENV | |
# To be able to create a commit we need some committer identity. | |
- run: | | |
git config user.name "rust-marker-ci" | |
git config user.email "rust.marker.ci@gmail.com" | |
# Create a release commit and tag | |
- run: scripts/release/set-version.sh ${{ env.release_version }} | |
--commit "🚀 Release v${{ env.release_version }}" | |
- run: | | |
for tag in ${{ env.tags }}; do | |
git tag $tag | |
done | |
# Create a next dev version commit | |
- run: scripts/release/set-version.sh ${{ env.next_dev_version }} | |
--commit "🚧 Development v${{ env.next_dev_version }}" | |
# Push the changes to the remote | |
- run: git push origin ${{ github.ref_name }} --force-with-lease | |
# We use `--force` because the tags that are pushed here will include the | |
# sliding `v{major}` and `v{major}.{minor}` tags, so we have to overwrite | |
# them with the new ones. To prevent force-pushing the master branch we | |
# do this push with --force in a separate step, so it's not fully atomic, | |
# but it's good enough. | |
- run: git push --force --atomic origin ${{ env.tags }} |