forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 3.99 KB
/
bump-version.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# The purpose of this workflow is to, once a month, trigger Wasmtime's release
# process. All that actually happens here is that whenever this is triggered it
# will send a PR to the main repository with the version numbers automatically
# bumped. The next stage of the process is to simply merge the PR, and the
# `push-tag.yml` process takes over from there.
#
# Note that this creates a commit and a PR with a personal access token to
# ensure that the PR gets CI triggered on it. Additionally the commit message
# is specifically worded to get recognized by `push-tag.yml`.
name: "Bump version number"
on:
schedule:
# “At 00:00 on day-of-month 5.”
#
# https://crontab.guru/#0_0_5_*_*
- cron: '0 0 5 * *'
# Allow manually triggering this request via the button at
# https://github.com/bytecodealliance/wasmtime/actions/workflows/bump-version.yml
workflow_dispatch:
inputs:
publish_cmd:
description: 'Publish script argument: "bump" or "bump-patch"'
required: false
default: 'bump'
jobs:
bump_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: rustup update stable && rustup default stable
- name: Bump versions locally
id: bump
run: |
rustc scripts/publish.rs
if [ "${{ github.event.inputs.publish_cmd }}" != "" ]; then
# this was manually triggered
./publish ${{ github.event.inputs.publish_cmd }}
else
# this was cron-triggered.
./publish bump
fi
version=$(grep '^version =' Cargo.toml | head -n 1 | sed 's/.*"\(.*\)"/\1/')
echo "::set-output name=version::$version"
- name: Commit version changes
run: |
git config user.name 'Wasmtime Publish'
git config user.email 'wasmtime-publish@users.noreply.github.com'
git commit -a -F-<<EOF
Bump Wasmtime to ${{ steps.bump.outputs.version }}
[automatically-tag-and-release-this-commit]
EOF
- name: Push to remote
run: |
git remote set-url origin https://git:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${{ github.repository }}
git push origin HEAD:ci/bump-version -f
- name: Make a PR
# Note that the syntax here is kinda funky, and the general gist is that
# I couldn't figure out a good way to have a multiline string-literal
# become a json-encoded string literal to send to GitHub. This
# represents my best attempt.
run: |
cat > pr-body <<-EOF
This is an automated pull request from CI which is intended to
notify maintainers that it's time to release Wasmtime version
${{ steps.bump.outputs.version }}. Version numbers have been bumped
in this PR automatically and the release process will automatically
enter the next stages once this PR is merged.
It's recommended that maintainers double-check that [RELEASES.md]
is up-to-date. If not please feel free to push to this PR any
modifications to the release notes. Additionally before merging it's
probably best to double-check the [release process] and make sure that
everything is ship-shape.
[RELEASES.md]: https://github.com/bytecodealliance/wasmtime/blob/main/RELEASES.md
[release process]: https://docs.wasmtime.dev/contributing-release-process.html
EOF
body=$(jq -sR < ./pr-body)
curl --include --request POST \
https://api.github.com/repos/${{ github.repository }}/pulls \
--header "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
--data @- << EOF
{
"head": "ci/bump-version",
"base": "${{ github.ref_name }}",
"title": "Release Wasmtime ${{ steps.bump.outputs.version }}",
"body": $body,
"maintainer_can_modify": true
}
EOF