release #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 1" # Runs on main by default every Monday | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| get-release-info: | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'verus-lang/verus' | |
| outputs: | |
| release_tag: ${{ steps.get_release_info.outputs.release_tag }} | |
| steps: | |
| - name: Get Release Info | |
| id: get_release_info | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| release_info=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
| https://api.github.com/repos/verus-lang/verus/releases/163437062) | |
| echo "release_tag=$(echo $release_info | jq -cr '.tag_name')" >> "$GITHUB_OUTPUT" | |
| build: | |
| needs: [get-release-info] | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| checkout_ref: ${{ needs.get-release-info.outputs.release_tag }} | |
| is_rolling: false | |
| # The artifacts created by the `build` job already contain the new manifest information. | |
| # The only responsibility of this job is to commit the new manifest file to the repo. | |
| commit-toolchain-manifest: | |
| needs: [get-release-info, build] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout release source | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ needs.get-release-info.outputs.release_tag }} | |
| fetch-depth: 0 | |
| token: ${{ secrets.CRATES_UPDATE_TOKEN }} | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: 1.97.1 | |
| - name: Configure git | |
| run: | | |
| git config --global user.name 'Release Toolchain Manifest Bot' | |
| git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| BRANCH="bot/release-toolchain-manifest-$(date +%Y%m%d)-${{ github.run_number }}" | |
| echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
| git checkout -b "$BRANCH" | |
| - name: Create toolchain manifest for the release | |
| working-directory: ./source | |
| run: | | |
| cargo run -p cargo-verus-toolchains --bin create-manifest -- --write-to-dir cargo-verus/toolchain-manifests | |
| - name: Commit toolchain manifest | |
| run: | | |
| git add source/cargo-verus/toolchain-manifests | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Add stable toolchain manifest" | |
| echo "CHANGED=true" >> $GITHUB_ENV | |
| else | |
| echo "No toolchain manifest was added" | |
| fi | |
| - name: Push branch and open PR | |
| if: env.CHANGED == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.CRATES_UPDATE_TOKEN }} | |
| version: ${{ needs.build.outputs.version }} | |
| PR_BODY: |- | |
| Automated toolchain manifest update for the latest stable release. | |
| CI run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| git push origin "$BRANCH" | |
| gh pr create \ | |
| --title "Add toolchain manifest for Release ${version}" \ | |
| --body "$PR_BODY" \ | |
| --base main | |
| gh pr merge --auto --merge | |
| copy-release: | |
| needs: [build] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: download all artifacts | |
| uses: actions/download-artifact@v8 | |
| - name: Create a New Release | |
| id: create_release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| version: ${{ needs.build.outputs.version }} | |
| run: | | |
| new_release_tag="release/${version}" | |
| new_release_name="Release ${version}" | |
| response=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"tag_name\": \"$new_release_tag\", \"name\": \"$new_release_name\"}" \ | |
| https://api.github.com/repos/verus-lang/verus/releases) | |
| echo $new_release_tag $new_release_name $response | |
| new_release_id=$(echo $response | jq -r '.id') | |
| echo "new_release_id=$new_release_id" >> $GITHUB_ENV | |
| - name: Copy Assets | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| new_release_id: ${{ env.new_release_id }} | |
| version: ${{ needs.build.outputs.version }} | |
| run: | | |
| assets=$(find verus-* -name '*.zip') | |
| for asset in $assets; do | |
| asset_name=$(basename $asset) | |
| release_asset_name="verus-${version}-${asset_name#verus-}" | |
| curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| --data-binary @$asset \ | |
| "https://uploads.github.com/repos/verus-lang/verus/releases/$new_release_id/assets?name=$release_asset_name" | |
| done |