Skip to content

Commit

Permalink
chore: dogfood multi-host drifting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Nov 24, 2023
1 parent 7c43793 commit b5b38f8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit b5b38f8

Please sign in to comment.