-
Notifications
You must be signed in to change notification settings - Fork 11
62 lines (50 loc) · 2.35 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 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 "[email protected]"
# 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
#
# We use `--force-with-lease` 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.
- run: git push --force --atomic origin ${{ github.ref_name }} ${{ env.tags }}