Files
wasmtime/.github/workflows/bump-version.yml
Alex Crichton 7b0238fd7e ci: Scope version bump branch name (#3894)
This avoids a situation such as for the last point release where we had
different point releases all use the same branch name which forced us
make one release at a time. By putting the version number in the branch
name that should hopefully fix this.
2022-03-07 13:41:31 -06:00

102 lines
4.0 KiB
YAML

# 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-to-${{ steps.bump.outputs.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-to-${{ steps.bump.outputs.version }}",
"base": "${{ github.ref_name }}",
"title": "Release Wasmtime ${{ steps.bump.outputs.version }}",
"body": $body,
"maintainer_can_modify": true
}
EOF