|
| 1 | + |
| 2 | +name: Generate and Sign Assertion Document |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ "main" ] |
| 7 | + pull_request: |
| 8 | + branches: [ "main" ] |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + branch: |
| 12 | + type: string |
| 13 | + description: "The branch to run the assertion workflow on" |
| 14 | + required: false |
| 15 | + default: main |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + if: ${{ !github.event.pull_request.head.repo.fork }} |
| 21 | + permissions: |
| 22 | + id-token: write |
| 23 | + contents: read |
| 24 | + env: |
| 25 | + GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-dev" |
| 26 | + |
| 27 | + outputs: |
| 28 | + agent_binary: ${{ steps.check_binary.outputs.agent_binary }} |
| 29 | + goversionm: ${{ steps.godeps.outputs.goversionm }} |
| 30 | + assertion_document: ${{ steps.assertiondoc.outputs.assertion-document-path }} |
| 31 | + signed_assertion_document: ${{ steps.sign.outputs.signed-assertion-document-path }} |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 35 | + |
| 36 | + - name: Set up Go |
| 37 | + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 |
| 38 | + with: |
| 39 | + go-version-file: go.mod |
| 40 | + cache: false |
| 41 | + |
| 42 | + - name: Build |
| 43 | + id: build |
| 44 | + run: | |
| 45 | + make build |
| 46 | +
|
| 47 | + - name: Check Binary |
| 48 | + id: check_binary |
| 49 | + run: | |
| 50 | + echo "agent_binary=$(find build -type f -name "nginx-agent" | head -n 1)" >> $GITHUB_OUTPUT |
| 51 | + cat $GITHUB_OUTPUT |
| 52 | +
|
| 53 | + - name: Check dependencies |
| 54 | + id: godeps |
| 55 | + run: | |
| 56 | + go version -m ${{ steps.check_binary.outputs.ptd_binary_path }} > goversionm_${{ github.run_id }}_${{ github.run_number }}.txt |
| 57 | + echo "goversionm=$(find -type f -name "goversionm*.txt" | head -n 1)" >> $GITHUB_OUTPUT |
| 58 | + cat $GITHUB_OUTPUT |
| 59 | +
|
| 60 | + - name: Generate Assertion Document |
| 61 | + id: assertiondoc |
| 62 | + uses: nginxinc/compliance-rules/.github/actions/assertion@main |
| 63 | + with: |
| 64 | + artifact-name: nginx-agent_${{ github.ref_name }} |
| 65 | + artifact-digest: 'test-digest' |
| 66 | + build-type: 'github' |
| 67 | + builder-id: 'github.com' |
| 68 | + builder-version: '0.1.0-xyz' |
| 69 | + invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} |
| 70 | + artifactory-user: ${{ secrets.ARTIFACTORY_USER }} |
| 71 | + artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }} |
| 72 | + artifactory-url: ${{ secrets.ARTIFACTORY_URL }} |
| 73 | + artifactory-repo: 'f5-nginx-go-local-approved-dependency' |
| 74 | + assertion-doc-file: assertion_nginx-agent_${{ github.ref_name }}.json |
| 75 | + build-content-path: ${{ steps.godeps.outputs.goversionm }} |
| 76 | + started-on: '' |
| 77 | + finished-on: '' |
| 78 | + |
| 79 | + - name: Sign and Store Assertion Document |
| 80 | + id: sign |
| 81 | + uses: nginxinc/compliance-rules/.github/actions/sign@main |
| 82 | + with: |
| 83 | + assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }} |
0 commit comments