diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d582790dd..5e676b168 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,7 @@ # * checks for a Git Tag that looks like a release # * builds artifacts with cargo-dist (archives, installers, hashes) # * uploads those artifacts to temporary workflow zip +# * on success, uploads the artifacts to Axo Releases and makes an Announcement # * on success, uploads the artifacts to a Github Release # # Note that the Github Release will be created with a generated @@ -54,6 +55,7 @@ jobs: publishing: ${{ !github.event.pull_request }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AXO_RELEASES_TOKEN: ${{ secrets.AXO_RELEASES_TOKEN }} steps: - uses: actions/checkout@v4 with: @@ -182,7 +184,16 @@ jobs: path: | ${{ steps.cargo-dist.outputs.paths }} ${{ env.BUILD_MANIFEST_NAME }} - # Determines if we should publish/announce + # Uploads the artifacts to Axo Releases and tentatively creates Releases for them. + # This makes perma URLs like /v1.0.0/ live for subsequent publish steps to use, but + # leaves them "disconnected" from the release history (for the purposes of + # "list the releases" or "give me the latest releases"). + # + # If all the subsequent "publish" steps succeed, the "announce" job will "connect" + # the releases and concepts like "latest" will be updated. Otherwise you're hopefully + # in a decent position to roll back the release without anyone noticing it! + # This is imperfect with things like "publish to crates.io" being irreversible, but + # at worst you're in a better position to yank the version with minimum disruption. host: needs: - plan @@ -192,6 +203,7 @@ jobs: if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AXO_RELEASES_TOKEN: ${{ secrets.AXO_RELEASES_TOKEN }} runs-on: "ubuntu-20.04" outputs: val: ${{ steps.host.outputs.manifest }} @@ -207,6 +219,7 @@ jobs: with: name: artifacts path: target/distrib/ + # Upload files to Axo Releases and create the Releases # This is a harmless no-op for Github Releases, hosting for that happens in "announce" - id: host shell: bash @@ -257,6 +270,7 @@ jobs: done git push + # Create an Announcement for all the Axo Releases, updating the "latest" release # Create a Github Release while uploading all files to it announce: needs: @@ -270,10 +284,21 @@ jobs: runs-on: "ubuntu-20.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AXO_RELEASES_TOKEN: ${{ secrets.AXO_RELEASES_TOKEN }} steps: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install cargo-dist + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.5.0-prerelease.11/cargo-dist-installer.sh | sh" + - name: Fetch Axo Artifacts + uses: actions/download-artifact@v3 + with: + name: artifacts + path: target/distrib/ + - name: Announce Axo Releases + run: | + cargo dist host --steps=announce ${{ needs.plan.outputs.tag-flag }} - name: "Download Github Artifacts" uses: actions/download-artifact@v3 with: diff --git a/Cargo.toml b/Cargo.toml index 4b1c949d4..5159256f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,8 @@ publish-jobs = ["homebrew"] targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] # Publish jobs to run in CI pr-run-mode = "plan" +# Where to host releases +hosting = ["axodotdev", "github"] # The profile that 'cargo dist' will build with [profile.dist]