|
3 | 3 | push: |
4 | 4 | tags: |
5 | 5 | - "v*" |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + dry-run: |
| 9 | + description: "Dry run — build and verify without pushing images or publishing" |
| 10 | + type: boolean |
| 11 | + default: true |
6 | 12 | permissions: |
7 | 13 | contents: read |
8 | 14 | packages: write |
9 | 15 | id-token: write |
| 16 | +env: |
| 17 | + DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run == true }} |
10 | 18 | jobs: |
11 | 19 | test: |
12 | 20 | runs-on: ubuntu-latest |
@@ -56,56 +64,75 @@ jobs: |
56 | 64 | name: initium-arm64 |
57 | 65 | path: bin/ |
58 | 66 | - run: mv bin/initium bin/initium-arm64 && chmod +x bin/initium-arm64 |
| 67 | + - name: Verify binaries |
| 68 | + run: | |
| 69 | + file bin/initium-amd64 bin/initium-arm64 |
| 70 | + echo "amd64 size: $(du -h bin/initium-amd64 | cut -f1)" |
| 71 | + echo "arm64 size: $(du -h bin/initium-arm64 | cut -f1)" |
59 | 72 | - uses: sigstore/cosign-installer@v3 |
| 73 | + if: env.DRY_RUN == 'false' |
60 | 74 | - uses: docker/setup-buildx-action@v3 |
61 | 75 | - uses: docker/login-action@v3 |
| 76 | + if: env.DRY_RUN == 'false' |
62 | 77 | with: |
63 | 78 | registry: ghcr.io |
64 | 79 | username: ${{ github.actor }} |
65 | 80 | password: ${{ secrets.GITHUB_TOKEN }} |
66 | 81 | - name: Extract version |
67 | 82 | id: version |
68 | | - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" |
69 | | - - uses: docker/build-push-action@v6 |
| 83 | + run: | |
| 84 | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then |
| 85 | + echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" |
| 86 | + else |
| 87 | + echo "VERSION=dry-run-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" |
| 88 | + fi |
| 89 | + - name: Build initium image |
| 90 | + uses: docker/build-push-action@v6 |
70 | 91 | id: build-main |
71 | 92 | with: |
72 | 93 | context: . |
73 | 94 | platforms: linux/amd64,linux/arm64 |
74 | | - push: true |
| 95 | + push: ${{ env.DRY_RUN == 'false' }} |
75 | 96 | tags: | |
76 | 97 | ghcr.io/kitstream/initium:${{ steps.version.outputs.VERSION }} |
77 | 98 | ghcr.io/kitstream/initium:latest |
78 | 99 | sbom: true |
79 | 100 | provenance: true |
80 | 101 | - name: Sign initium image |
| 102 | + if: env.DRY_RUN == 'false' |
81 | 103 | run: cosign sign --yes ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }} |
82 | 104 | - name: SBOM attestation for initium image |
| 105 | + if: env.DRY_RUN == 'false' |
83 | 106 | run: | |
84 | 107 | cosign attest --yes --type spdx \ |
85 | 108 | --predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }} --format '{{json (index .SBOM "linux/amd64").SPDX}}') \ |
86 | 109 | ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }} |
87 | | - - uses: docker/build-push-action@v6 |
| 110 | + - name: Build initium-jyq image |
| 111 | + uses: docker/build-push-action@v6 |
88 | 112 | id: build-jyq |
89 | 113 | with: |
90 | 114 | context: . |
91 | 115 | file: Dockerfile.jyq |
92 | 116 | platforms: linux/amd64,linux/arm64 |
93 | | - push: true |
| 117 | + push: ${{ env.DRY_RUN == 'false' }} |
94 | 118 | tags: | |
95 | 119 | ghcr.io/kitstream/initium-jyq:${{ steps.version.outputs.VERSION }} |
96 | 120 | ghcr.io/kitstream/initium-jyq:latest |
97 | 121 | sbom: true |
98 | 122 | provenance: true |
99 | 123 | - name: Sign initium-jyq image |
| 124 | + if: env.DRY_RUN == 'false' |
100 | 125 | run: cosign sign --yes ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }} |
101 | 126 | - name: SBOM attestation for initium-jyq image |
| 127 | + if: env.DRY_RUN == 'false' |
102 | 128 | run: | |
103 | 129 | cosign attest --yes --type spdx \ |
104 | 130 | --predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }} --format '{{json (index .SBOM "linux/amd64").SPDX}}') \ |
105 | 131 | ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }} |
106 | 132 | publish: |
107 | 133 | runs-on: ubuntu-latest |
108 | 134 | needs: [docker] |
| 135 | + if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.dry-run == true) }} |
109 | 136 | steps: |
110 | 137 | - uses: actions/checkout@v4 |
111 | 138 | - uses: dtolnay/rust-toolchain@stable |
|
0 commit comments