Skip to content

Commit bdc1e24

Browse files
committed
gh-actions: attest & package if publish is true
1 parent f16abc8 commit bdc1e24

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

.github/workflows/go.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
artifact-subjects: ${{ steps.post-build.outputs.subjects }}
2727
sbom-info: ${{ steps.post-build.outputs.sbom-info }}
2828
vcs-ver: ${{ steps.post-build.outputs.vcs-ver }}
29+
publish: ${{ steps.post-build.outputs.publish }}
2930
env:
3031
FOUT: firestack.aar
3132
FOUTDBG: firestack-debug.aar
@@ -283,18 +284,20 @@ jobs:
283284
printf 'subjects=%s\n' "$subjects" >> "$GITHUB_OUTPUT"
284285
printf 'sbom-info=%s\n' "$sbominfo" >> "$GITHUB_OUTPUT"
285286
printf 'vcs-ver=%s\n' "$VCSVER" >> "$GITHUB_OUTPUT"
287+
printf 'publish=%s\n' "$PUBLISH" >> "$GITHUB_OUTPUT"
286288
shell: bash
287289
env:
288290
SBOM_PATH: _manifest/spdx_2.2/
289291
SBOM_FNAME: manifest.spdx.json
290292
SBOM_ARTIFACT_ID: ${{ steps.sbom-upload.outputs.artifact-id }}
291293
SBOM_ARTIFACT_NAME: ${{ format('firestack-sbom-{0}', github.sha) }}
292294
GRYPE_SARIF: ${{ steps.gr.outputs.sarif }}
295+
PUBLISH: ${{ github.event_name == 'workflow_dispatch' }}
293296

294297
attestation:
295298
name: 🪪 Artifact attestations
296299
needs: build
297-
if: ${{ needs.build.result == 'success' && needs.build.outputs.artifact-subjects != '' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
300+
if: ${{ needs.build.result == 'success' && needs.build.outputs.artifact-subjects != '' && needs.build.outputs.publish == 'true' }}
298301
uses: ./.github/workflows/provenance.yml
299302
with:
300303
subjects: ${{ needs.build.outputs.artifact-subjects }}
@@ -305,7 +308,7 @@ jobs:
305308
needs:
306309
- build
307310
- attestation
308-
if: ${{ needs.build.result == 'success' && needs.attestation.result == 'success' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
311+
if: ${{ needs.build.result == 'success' && needs.attestation.result == 'success' && needs.build.outputs.publish == 'true' }}
309312
runs-on: ubuntu-latest
310313
permissions:
311314
contents: read
@@ -396,7 +399,6 @@ jobs:
396399
done
397400
398401
- name: 🏷️ Setup for GitHub Packages
399-
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
400402
uses: actions/setup-java@v4
401403
with:
402404
java-version: '17'
@@ -405,7 +407,6 @@ jobs:
405407
# docs.github.com/en/actions/tutorials/build-and-test-code/java-with-maven
406408
# docs.github.com/en/actions/tutorials/publish-packages/publish-java-packages-with-maven#publishing-packages-to-github-packages
407409
- name: 😺 GitHub Packages
408-
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
409410
shell: bash
410411
env:
411412
REPOSITORY: ${{ github.repository }}
@@ -435,7 +436,6 @@ jobs:
435436
# github.com/slsa-framework/slsa-github-generator/blob/4876e96b8268/actions/maven/publish/action.yml#L49
436437
# docs.github.com/en/actions/tutorials/publish-packages/publish-java-packages-with-maven#publishing-packages-to-the-maven-central-repository-and-github-packages
437438
- name: 🏛️ Setup for Maven Central
438-
if: ${{ github.event_name == 'workflow_dispatch' }}
439439
uses: actions/setup-java@v4
440440
with:
441441
java-version: '17'
@@ -447,7 +447,6 @@ jobs:
447447
gpg-passphrase: ${{ secrets.OSSRH_CELZERO_GPG_PASSPHRASE }}
448448

449449
- name: 📦 Publish to Maven Central
450-
if: ${{ github.event_name == 'workflow_dispatch' }}
451450
shell: bash
452451
env:
453452
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}

0 commit comments

Comments
 (0)