|
1 | 1 | name: "🚀 Release image" |
2 | 2 |
|
3 | | -# A v* tag publishes the manager image and its Helm chart: build from the |
4 | | -# pinned web ref, prove the image with the read-only health check, then push |
| 3 | +# A v* tag publishes the manager image and its Helm chart: build with the |
| 4 | +# web console from cryptos-web's tag of the same name (the two repos are |
| 5 | +# versioned in lockstep), prove the image with the read-only health check, then push |
5 | 6 | # only if that check passes. `latest` moves only on a stable tag (no "-" |
6 | 7 | # prerelease suffix); an rc tag publishes its own tag but never latest. The |
7 | 8 | # chart version always matches the tag (without its leading "v"). The node |
@@ -29,29 +30,32 @@ jobs: |
29 | 30 | NET: fleet-release-check |
30 | 31 | REGISTRY_IMAGE: ghcr.io/cryptos-pki/cryptos-manager |
31 | 32 | steps: |
32 | | - # A tagged image has to be rebuildable from the tag. Falling back to |
33 | | - # web's main would embed whatever web happened to be at build time, so |
34 | | - # the release refuses to build until the web ref is pinned. |
35 | | - - name: Require a pinned web ref |
| 33 | + # cryptos-manager and cryptos-web are versioned in lockstep: the image |
| 34 | + # for vX.Y.Z embeds the web console from cryptos-web's vX.Y.Z. That |
| 35 | + # release has to be published first; the releases/tags endpoint only |
| 36 | + # returns published releases, so a draft or a missing tag fails here. |
| 37 | + - name: Require the matching cryptos-web release |
36 | 38 | env: |
37 | | - WEB_RELEASE_REF: ${{ vars.WEB_RELEASE_REF }} |
| 39 | + GH_TOKEN: ${{ github.token }} |
| 40 | + TAG: ${{ github.ref_name }} |
38 | 41 | run: | |
39 | | - if [ -z "$WEB_RELEASE_REF" ]; then |
40 | | - echo "::error::Set the WEB_RELEASE_REF repository variable to a web tag or commit SHA before cutting a release." |
| 42 | + set -euo pipefail |
| 43 | + if ! draft="$(gh api "repos/CryptOS-PKI/cryptos-web/releases/tags/$TAG" -q .draft 2>/dev/null)" || [ "$draft" != "false" ]; then |
| 44 | + echo "::error::cryptos-web has no published release at $TAG. The two repos are versioned in lockstep: publish cryptos-web's $TAG draft first (with the same version), then re-run this workflow." |
41 | 45 | exit 1 |
42 | 46 | fi |
43 | | - echo "web ref: $WEB_RELEASE_REF" |
| 47 | + echo "web release: $TAG" |
44 | 48 |
|
45 | 49 | - name: Checkout manager |
46 | 50 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
47 | 51 | with: |
48 | 52 | path: manager |
49 | 53 |
|
50 | | - - name: Checkout web (pinned) |
| 54 | + - name: Checkout web (same tag) |
51 | 55 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
52 | 56 | with: |
53 | 57 | repository: CryptOS-PKI/cryptos-web |
54 | | - ref: ${{ vars.WEB_RELEASE_REF }} |
| 58 | + ref: refs/tags/${{ github.ref_name }} |
55 | 59 | path: web |
56 | 60 |
|
57 | 61 | # Resolve what is actually being built, so the image can report it (#81). |
|
0 commit comments