1# The purpose of this workflow is to orchestrate Wasmtime's release process as 2# much as possible. This specific workflow is responsible for a few timed parts 3# of the process: 4# 5# * On the 5th of every month a new release branch is automatically created and 6# the version number of the `main` branch is increased 7# * On the 20th of every month the previous release branch is published. 8# 9# This automation is all done through PRs except for the creation of the release 10# branch itself which is an write-action performed by this script. Otherwise 11# humans are ideally reviewing and rubber-stamping the output of the script all 12# other steps of the way. 13# 14# Note that this script also helps manage patch releases by sending a PR to the 15# release branch with a bumped version number for all crates with a patch-bump. 16 17name: "Automated Release Process" 18on: 19 schedule: 20 # “At 00:00 on day-of-month 5.” 21 # 22 # https://crontab.guru/#0_0_5_*_* 23 - cron: '0 0 5 * *' 24 - cron: '0 0 20 * *' 25 26 # Allow manually triggering this request via the button at 27 # https://github.com/bytecodealliance/wasmtime/actions/workflows/release-process.yml 28 workflow_dispatch: 29 inputs: 30 action: 31 description: 'Publish script argument: "cut", "release-latest", or "release-patch"' 32 required: false 33 default: 'cut' 34 35jobs: 36 release_process: 37 if: "github.repository == 'bytecodealliance/wasmtime' || !github.event.schedule" 38 name: Run the release process 39 runs-on: ubuntu-latest 40 steps: 41 - uses: actions/checkout@v4 42 with: 43 submodules: true 44 - name: Setup 45 run: | 46 rustc scripts/publish.rs 47 git config user.name 'Wasmtime Publish' 48 git config user.email '[email protected]' 49 git remote set-url origin https://git:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${{ github.repository }} 50 51 - uses: ./.github/actions/install-rust 52 - uses: ./.github/actions/install-cargo-vet 53 54 - name: Bump major version number 55 run: | 56 set -ex 57 # Push the current contents of `main` to a new release branch 58 cur=$(./ci/print-current-version.sh) 59 git push origin HEAD:release-$cur 60 61 # Update version numbers and make a commit indicating that. Note that 62 # on merge this will not trigger a publish. 63 ./publish bump 64 num=$(./ci/print-current-version.sh) 65 66 # Add a new section to the release notes for the new version. 67 cp RELEASES.md backup-releases 68 sed "s/VERSION/$num/" ci/RELEASES-template.md > RELEASES.md 69 cat backup-releases >> RELEASES.md 70 rm backup-releases 71 72 # Update `cargo vet` entries for all the new crate versions 73 cargo vet 74 75 # Commit all of the above changes. 76 git commit -am "Bump Wasmtime to $num" 77 78 # Push the result to a branch and setup metadata for the step below 79 # that creates a PR 80 git push origin HEAD:ci/bump-to-$num 81 echo "PR_HEAD=ci/bump-to-$num" >> $GITHUB_ENV 82 echo "PR_TITLE=Bump Wasmtime to $num" >> $GITHUB_ENV 83 echo "PR_BASE=main" >> $GITHUB_ENV 84 cat > pr-body <<-EOF 85 This is an [automated pull request][process] from CI which indicates 86 that the next [\`release-$cur\` branch][branch] has been created and 87 the \`main\` branch is getting its version number bumped from $cur to 88 $num. 89 90 Maintainers should take a moment to review the [release 91 notes][RELEASES.md] for $cur, and if any changes are necessary send 92 PRs to the \`main\` branch to update [RELEASES.md] and then backport 93 these PRs to the [release branch][branch]. 94 95 Maintainers should also review that aarch64-apple-darwin builds 96 are passing via [embark's CI](https://buildkite.com/embark-studios/wasmtime-aarch64-apple-darwin). 97 98 Another automated PR will be made in roughly 2 weeks time when for 99 the actual release itself. 100 101 If any issues arise on the \`main\` branch before the release is made 102 then the issue should first be fixed on \`main\` and then backported 103 to the \`release-$cur\` branch. 104 105 [RELEASES.md]: https://github.com/${{ github.repository }}/blob/main/RELEASES.md 106 [branch]: https://github.com/${{ github.repository }}/tree/release-$cur 107 [process]: https://docs.wasmtime.dev/contributing-release-process.html 108 EOF 109 if: >- 110 github.event.schedule == '0 0 5 * *' || 111 github.event.inputs.action == 'cut' 112 113 - name: Perform latest release 114 run: | 115 set -ex 116 git fetch origin 117 118 # Determine the latest release branch 119 rustc ci/find-latest-release.rs -o /tmp/find-latest-release 120 cur=`/tmp/find-latest-release` 121 122 # Update the release date of $cur in RELEASES.md 123 rustc ci/update-release-date.rs -o /tmp/update-release-date 124 /tmp/update-release-date $(date +'%Y-%m-%d') 125 126 git commit --allow-empty -a -F-<<EOF 127 Update release date of Wasmtime $cur 128 EOF 129 git push origin HEAD:ci/release-date-for-$cur 130 131 # In addition to the PR we'll make below to perform the actual release 132 # make a second PR to the `main` branch to note the release date in 133 # the release notes. 134 cat > pr-body <<-EOF 135 This is an [automated pull request][process] from CI which is updating 136 the release date of Wasmtime $cur to today. This PR's base branch 137 is \`main\` and a second PR will be coming to perform the actual 138 release which will be targeted at \`release-$cur\`. 139 140 [process]: https://docs.wasmtime.dev/contributing-release-process.html 141 EOF 142 body=$(jq -sR < ./pr-body) 143 curl --include --request POST \ 144 https://api.github.com/repos/${{ github.repository }}/pulls \ 145 --header "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ 146 --data @- << EOF 147 { 148 "head": "ci/release-date-for-$cur", 149 "base": "main", 150 "title": "Update release date of Wasmtime $cur", 151 "body": $body, 152 "maintainer_can_modify": true 153 } 154 EOF 155 156 # Move to the most recent release branch, update the release date and 157 # commit it, indicating that the commit is what will get tagged and 158 # released 159 git reset --hard origin/release-$cur 160 git submodule update --init --recursive 161 sed -i "s/^Unreleased/Released $(date +'%Y-%m-%d')/" RELEASES.md 162 git commit --allow-empty -a -F-<<EOF 163 Release Wasmtime $cur 164 165 [automatically-tag-and-release-this-commit] 166 EOF 167 168 # Push the result to a branch and setup metadata for the step below 169 # that creates a PR 170 git push origin HEAD:ci/release-$cur 171 echo "PR_HEAD=ci/release-$cur" >> $GITHUB_ENV 172 echo "PR_TITLE=Release Wasmtime $cur" >> $GITHUB_ENV 173 echo "PR_BASE=release-$cur" >> $GITHUB_ENV 174 cat > pr-body <<-EOF 175 This is an [automated pull request][process] from CI which is 176 intended to notify maintainers that it's time to release Wasmtime 177 $cur. The [release branch][branch] was created roughly two weeks ago 178 and it's now time for it to be published and released. 179 180 It's recommended that maintainers double-check that [RELEASES.md] 181 is up-to-date and that there are no known issues before merging this 182 PR. When this PR is merged a release tag will automatically be 183 created, crates will be published, and CI artifacts will be produced. 184 185 [RELEASES.md]: https://github.com/${{ github.repository }}/blob/main/RELEASES.md 186 [process]: https://docs.wasmtime.dev/contributing-release-process.html 187 [branch]: https://github.com/${{ github.repository }}/tree/release-$cur 188 EOF 189 if: >- 190 github.event.schedule == '0 0 20 * *' || 191 github.event.inputs.action == 'release-latest' 192 193 - name: Bump and release patch version number 194 run: | 195 set -ex 196 # Update version numbers on a patch basis and update RELEASES.md if a 197 # patch release marker is already in there. Note that this commit 198 # message indicates that on-merge a release will be made. 199 ./publish bump-patch 200 # Update `cargo vet` entries for all the new crate versions 201 cargo vet 202 sed -i "s/^Unreleased/Released $(date +'%Y-%m-%d')/" RELEASES.md 203 num=$(./ci/print-current-version.sh) 204 git commit -a -F-<<EOF 205 Release Wasmtime $num 206 207 [automatically-tag-and-release-this-commit] 208 EOF 209 210 # Push the result to a branch and setup metadata for the step below 211 # that creates a PR 212 git push origin HEAD:ci/bump-to-$num 213 echo "PR_HEAD=ci/bump-to-$num" >> $GITHUB_ENV 214 echo "PR_TITLE=Release Wasmtime $num" >> $GITHUB_ENV 215 echo "PR_BASE=${{ github.ref_name }}" >> $GITHUB_ENV 216 cat > pr-body <<-EOF 217 This is an [automated pull request][process] from CI to create a patch 218 release for Wasmtime $num, requested by @${{ github.actor }}. 219 220 It's recommended that maintainers double-check that [RELEASES.md] 221 is up-to-date and that there are no known issues before merging this 222 PR. When this PR is merged a release tag will automatically be 223 created, crates will be published, and CI artifacts will be produced. 224 225 [RELEASES.md]: https://github.com/${{ github.repository }}/blob/main/RELEASES.md 226 [process]: https://docs.wasmtime.dev/contributing-release-process.html 227 EOF 228 229 if: github.event.inputs.action == 'release-patch' 230 231 - name: Make a PR 232 # Note that the syntax here is kinda funky, and the general gist is that 233 # I couldn't figure out a good way to have a multiline string-literal 234 # become a json-encoded string literal to send to GitHub. This 235 # represents my best attempt. 236 run: | 237 set -ex 238 body=$(jq -sR < ./pr-body) 239 240 curl --include --request POST \ 241 https://api.github.com/repos/${{ github.repository }}/pulls \ 242 --header "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ 243 --data @- << EOF 244 { 245 "head": "$PR_HEAD", 246 "base": "$PR_BASE", 247 "title": "$PR_TITLE", 248 "body": $body, 249 "maintainer_can_modify": true 250 251 } 252 EOF 253