-
Notifications
You must be signed in to change notification settings - Fork 197
79 lines (67 loc) · 2.8 KB
/
release-process.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Initiation half of the release process for this repository.
#
# This is triggered manually through the github actions UI and will execute
# `./publish bump` (or `bump-patch`). Afterwards the result will be pushed to a
# branch in the main repository and a PR will be opened. This PR, when merged,
# will trigger the second half in `publish.yml`.
name: "Automated Release Process"
on:
# Allow manually triggering this request via the button on the action
# workflow page.
workflow_dispatch:
inputs:
action:
description: 'Publish script argument: "bump", or "bump-patch"'
required: false
default: 'bump'
permissions:
contents: write
pull-requests: write
jobs:
release_process:
name: Run the release process
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup
run: |
rustc ci/publish.rs
git config user.name 'Auto Release Process'
git config user.email '[email protected]'
git remote set-url origin https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Bump version number
run: ./publish ${{ github.event.inputs.action }}
# Regenerate precompiled artifacts in this repo as they're dependent on
# the version number.
- uses: ./.github/actions/install-wasi-sdk
- run: ./ci/rebuild-libcabi-realloc.sh
- name: Prep PR metadata
run: |
set -ex
git fetch origin
cur=$(./ci/print-current-version.sh)
git commit --allow-empty -a -F-<<EOF
Release ${{ github.event.repository.name }} $cur
[automatically-tag-and-release-this-commit]
EOF
# Push the result to a branch and setup metadata for the step below
# that creates a PR
git push origin HEAD:ci/release-$cur
echo "PR_HEAD=ci/release-$cur" >> $GITHUB_ENV
echo "PR_TITLE=Release ${{ github.event.repository.name }} $cur" >> $GITHUB_ENV
echo "PR_BASE=main" >> $GITHUB_ENV
cat > pr-body <<-EOF
This is an automated pull request from CI to release
${{ github.event.repository.name }} $cur when merged. The commit
message for this PR has a marker that is detected by CI to create
tags and publish crate artifacts.
When first opened this PR will not have CI run because it is generated
by a bot. A maintainer should close this PR and then reopen it to
trigger CI to execute which will then enable merging this PR.
EOF
- name: Make a PR
run: gh pr create -B "$PR_BASE" -H "$PR_HEAD" --title "$PR_TITLE" --body "$(cat ./pr-body)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}