Skip to content

Commit

Permalink
Publish packages even on pre-release (#2622)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman authored Feb 4, 2025
1 parent df6e6f5 commit 24bb017
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Lifted from what dist would generate as the homebrew publish step, except rewriting the download urls to use scarf.
# We also need to deliberately skip any publish steps here if this is a pre-release, as Homebrew doesn't support prereleases.

name: Publish homebrew formulae

Expand All @@ -16,8 +15,6 @@ env:

jobs:
publish-homebrew-formula:
# homebrew only really has a single 'latest' version, so we must skip prereleases
if: ${{ !fromJson(inputs.plan).announcement_is_prerelease }}
runs-on: "ubuntu-20.04"
env:
GITHUB_USER: "Restate bot"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
PLAN: ${{ inputs.plan }}

jobs:
scarf:
release-notes:
permissions:
contents: write
runs-on: ubuntu-latest
Expand Down
53 changes: 22 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,45 +344,15 @@ jobs:
"id-token": "write"
"packages": "write"

custom-docker-release:
needs:
- plan
- host
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
uses: ./.github/workflows/docker-release.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
# publish jobs get escalated permissions
permissions:
"id-token": "write"
"packages": "write"

custom-npm:
needs:
- plan
- host
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
uses: ./.github/workflows/npm.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
# publish jobs get escalated permissions
permissions:
"contents": "read"
"packages": "read"

announce:
needs:
- plan
- host
- custom-homebrew
- custom-docker-release
- custom-npm
# use "always() && ..." to allow us to wait for all publish jobs while
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' && (needs.custom-homebrew.result == 'skipped' || needs.custom-homebrew.result == 'success') && (needs.custom-docker-release.result == 'skipped' || needs.custom-docker-release.result == 'success') && (needs.custom-npm.result == 'skipped' || needs.custom-npm.result == 'success') }}
if: ${{ always() && needs.host.result == 'success' && (needs.custom-homebrew.result == 'skipped' || needs.custom-homebrew.result == 'success') }}
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -391,6 +361,15 @@ jobs:
with:
submodules: recursive

custom-docker-release:
needs:
- plan
- announce
uses: ./.github/workflows/docker-release.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit

custom-helm:
needs:
- plan
Expand All @@ -408,3 +387,15 @@ jobs:
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit

custom-npm:
needs:
- plan
- announce
uses: ./.github/workflows/npm.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
permissions:
"contents": "read"
"packages": "read"
12 changes: 7 additions & 5 deletions dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ github-build-setup = "steps/release-build-setup.yml"
include = ["NOTICE"]
precise-builds = true
cache-builds = false
# npm and docker can handle pre-releases, we will skip homebrew manually
publish-preleases = true

# ci goes here because we want it to start early, and we don't want to create a release unless it succeeds
local-artifacts-jobs = ["./ci"]
# create release goes here because it needs to have happened before the host steps, which expect a draft release to already exist
global-artifacts-jobs = ["./notarize"]
publish-jobs = ["./homebrew", "./docker-release", "./npm"]
# helm goes here because it shouldn't exist before docker-release happens
post-announce-jobs = ["./helm", "./release-notes"]
# publish jobs wont happen on pre-release, hence we put homebrew here
publish-jobs = ["./homebrew"]
# these will happen even on pre-release, which is acceptable but not mandatory for npm, docker, helm, and helps us test these.
# nb there is a slight race here where we can create the helm chart before the docker container is pushed
# ideally the docker release would be in publish jobs but then it wouldn't happen on pre-release
# relevant: https://github.com/axodotdev/cargo-dist/issues/1744
post-announce-jobs = [ "./docker-release", "./helm", "./release-notes", "./npm"]

[dist.github-custom-job-permissions.ci]
packages = "read"
Expand Down

0 comments on commit 24bb017

Please sign in to comment.