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@v3 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 - name: Bump major version number 52 run: | 53 set -ex 54 # Push the current contents of `main` to a new release branch 55 cur=$(./ci/print-current-version.sh) 56 git push origin HEAD:release-$cur 57 58 # Update version numbers and make a commit indicating that. Note that 59 # on merge this will not trigger a publish. 60 ./publish bump 61 num=$(./ci/print-current-version.sh) 62 63 # Add a new section to the release notes for the new version. 64 cp RELEASES.md backup-releases 65 sed "s/VERSION/$num/" ci/RELEASES-template.md > RELEASES.md 66 cat backup-releases >> RELEASES.md 67 rm backup-releases 68 69 # Commit all of the above changes. 70 git commit -am "Bump Wasmtime to $num" 71 72 # Push the result to a branch and setup metadata for the step below 73 # that creates a PR 74 git push origin HEAD:ci/bump-to-$num 75 echo "PR_HEAD=ci/bump-to-$num" >> $GITHUB_ENV 76 echo "PR_TITLE=Bump Wasmtime to $num" >> $GITHUB_ENV 77 echo "PR_BASE=main" >> $GITHUB_ENV 78 cat > pr-body <<-EOF 79 This is an [automated pull request][process] from CI which indicates 80 that the next [\`release-$cur\` branch][branch] has been created and 81 the \`main\` branch is getting its version number bumped from $cur to 82 $num. 83 84 Maintainers should take a moment to review the [release 85 notes][RELEASES.md] for $cur, and if any changes are necessary send 86 PRs to the \`main\` branch to update [RELEASES.md] and then backport 87 these PRs to the [release branch][branch]. 88 89 Maintainers should also review that aarch64-apple-darwin builds 90 are passing via [embark's CI](https://buildkite.com/embark-studios/wasmtime-aarch64-apple-darwin). 91 92 Another automated PR will be made in roughly 2 weeks time when for 93 the actual release itself. 94 95 If any issues arise on the \`main\` branch before the release is made 96 then the issue should first be fixed on \`main\` and then backported 97 to the \`release-$cur\` branch. 98 99 [RELEASES.md]: https://github.com/${{ github.repository }}/blob/main/RELEASES.md 100 [branch]: https://github.com/${{ github.repository }}/tree/release-$cur 101 [process]: https://docs.wasmtime.dev/contributing-release-process.html 102 EOF 103 if: >- 104 github.event.schedule == '0 0 5 * *' || 105 github.event.inputs.action == 'cut' 106 107 - name: Perform latest release 108 run: | 109 set -ex 110 git fetch origin 111 112 # Determine the latest release branch 113 rustc ci/find-latest-release.rs -o /tmp/find-latest-release 114 cur=`/tmp/find-latest-release` 115 116 # Update the release date of $cur in RELEASES.md 117 rustc ci/update-release-date.rs -o /tmp/update-release-date 118 /tmp/update-release-date $(date +'%Y-%m-%d') 119 120 git commit --allow-empty -a -F-<<EOF 121 Update release date of Wasmtime $cur 122 EOF 123 git push origin HEAD:ci/release-date-for-$cur 124 125 # In addition to the PR we'll make below to perform the actual release 126 # make a second PR to the `main` branch to note the release date in 127 # the release notes. 128 cat > pr-body <<-EOF 129 This is an [automated pull request][process] from CI which is updating 130 the release date of Wasmtime $cur to today. This PR's base branch 131 is \`main\` and a second PR will be coming to perform the actual 132 release which will be targeted at \`release-$cur\`. 133 134 [process]: https://docs.wasmtime.dev/contributing-release-process.html 135 EOF 136 body=$(jq -sR < ./pr-body) 137 curl --include --request POST \ 138 https://api.github.com/repos/${{ github.repository }}/pulls \ 139 --header "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ 140 --data @- << EOF 141 { 142 "head": "ci/release-date-for-$cur", 143 "base": "main", 144 "title": "Update release date of Wasmtime $cur", 145 "body": $body, 146 "maintainer_can_modify": true 147 } 148 EOF 149 150 # Move to the most recent release branch, update the release date and 151 # commit it, indicating that the commit is what will get tagged and 152 # released 153 git reset --hard origin/release-$cur 154 git submodule update --init --recursive 155 sed -i "s/^Unreleased/Released $(date +'%Y-%m-%d')/" RELEASES.md 156 git commit --allow-empty -a -F-<<EOF 157 Release Wasmtime $cur 158 159 [automatically-tag-and-release-this-commit] 160 EOF 161 162 # Push the result to a branch and setup metadata for the step below 163 # that creates a PR 164 git push origin HEAD:ci/release-$cur 165 echo "PR_HEAD=ci/release-$cur" >> $GITHUB_ENV 166 echo "PR_TITLE=Release Wasmtime $cur" >> $GITHUB_ENV 167 echo "PR_BASE=release-$cur" >> $GITHUB_ENV 168 cat > pr-body <<-EOF 169 This is an [automated pull request][process] from CI which is 170 intended to notify maintainers that it's time to release Wasmtime 171 $cur. The [release branch][branch] was created roughly two weeks ago 172 and it's now time for it to be published and released. 173 174 It's recommended that maintainers double-check that [RELEASES.md] 175 is up-to-date and that there are no known issues before merging this 176 PR. When this PR is merged a release tag will automatically be 177 created, crates will be published, and CI artifacts will be produced. 178 179 [RELEASES.md]: https://github.com/${{ github.repository }}/blob/main/RELEASES.md 180 [process]: https://docs.wasmtime.dev/contributing-release-process.html 181 [branch]: https://github.com/${{ github.repository }}/tree/release-$cur 182 EOF 183 if: >- 184 github.event.schedule == '0 0 20 * *' || 185 github.event.inputs.action == 'release-latest' 186 187 - name: Bump and release patch version number 188 run: | 189 set -ex 190 # Update version numbers on a patch basis and update RELEASES.md if a 191 # patch release marker is already in there. Note that this commit 192 # message indicates that on-merge a release will be made. 193 ./publish bump-patch 194 sed -i "s/^Unreleased/Released $(date +'%Y-%m-%d')/" RELEASES.md 195 num=$(./ci/print-current-version.sh) 196 git commit -a -F-<<EOF 197 Release Wasmtime $num 198 199 [automatically-tag-and-release-this-commit] 200 EOF 201 202 # Push the result to a branch and setup metadata for the step below 203 # that creates a PR 204 git push origin HEAD:ci/bump-to-$num 205 echo "PR_HEAD=ci/bump-to-$num" >> $GITHUB_ENV 206 echo "PR_TITLE=Release Wasmtime $num" >> $GITHUB_ENV 207 echo "PR_BASE=${{ github.ref_name }}" >> $GITHUB_ENV 208 cat > pr-body <<-EOF 209 This is an [automated pull request][process] from CI to create a patch 210 release for Wasmtime $num, requested by @${{ github.actor }}. 211 212 It's recommended that maintainers double-check that [RELEASES.md] 213 is up-to-date and that there are no known issues before merging this 214 PR. When this PR is merged a release tag will automatically be 215 created, crates will be published, and CI artifacts will be produced. 216 217 [RELEASES.md]: https://github.com/${{ github.repository }}/blob/main/RELEASES.md 218 [process]: https://docs.wasmtime.dev/contributing-release-process.html 219 EOF 220 221 if: github.event.inputs.action == 'release-patch' 222 223 - name: Make a PR 224 # Note that the syntax here is kinda funky, and the general gist is that 225 # I couldn't figure out a good way to have a multiline string-literal 226 # become a json-encoded string literal to send to GitHub. This 227 # represents my best attempt. 228 run: | 229 set -ex 230 body=$(jq -sR < ./pr-body) 231 232 curl --include --request POST \ 233 https://api.github.com/repos/${{ github.repository }}/pulls \ 234 --header "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ 235 --data @- << EOF 236 { 237 "head": "$PR_HEAD", 238 "base": "$PR_BASE", 239 "title": "$PR_TITLE", 240 "body": $body, 241 "maintainer_can_modify": true 242 243 } 244 EOF 245