|
| 1 | +# see /README.md |
| 2 | + |
| 3 | +name: build-and-sign |
| 4 | +run-name: Demo workflow signing with SignPath |
| 5 | +on: |
| 6 | + push: |
| 7 | + pull_request: |
| 8 | + #schedule: |
| 9 | + # - cron: '30 3 * * *' # every day at 3:30am UTC |
| 10 | + workflow_dispatch: # Allows you to run this workflow manually from the Actions tab |
| 11 | + |
| 12 | +jobs: |
| 13 | + build_and_sign: |
| 14 | + runs-on: windows-latest |
| 15 | + steps: |
| 16 | + |
| 17 | + - name: checkout |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: build |
| 23 | + run: ./src/Build.ps1 |
| 24 | + |
| 25 | + - name: create SBOM |
| 26 | + run: ./sbom/Create-SBOM.ps1 |
| 27 | + |
| 28 | + - name: upload-unsigned-artifact |
| 29 | + id: upload-unsigned-artifact |
| 30 | + uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: "demo-application" |
| 33 | + if-no-files-found: error |
| 34 | + path: | |
| 35 | + .\_BuildResult-unsigned\DemoExample.msi |
| 36 | + .\_BuildResult-unsigned\bom.xml |
| 37 | +
|
| 38 | + - name: sign |
| 39 | + |
| 40 | + env: |
| 41 | + # select release-signing policy for main and release branches |
| 42 | + SIGNPATH_SIGNING_POLICY_SLUG: | |
| 43 | + ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) |
| 44 | + && 'release-signing' |
| 45 | + || 'test-signing' }} |
| 46 | + with: |
| 47 | + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' |
| 48 | + organization-id: '${{ vars.SIGNPATH_ORGANIZATION_ID }}' |
| 49 | + project-slug: 'Demo_Application' |
| 50 | + signing-policy-slug: '${{ env.SIGNPATH_SIGNING_POLICY_SLUG }}' |
| 51 | + github-artifact-id: "${{steps.upload-unsigned-artifact.outputs.artifact-id}}" |
| 52 | + wait-for-completion: true |
| 53 | + output-artifact-directory: 'demo-application-signed' |
| 54 | + |
| 55 | + - name: upload-signed-artifact |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: "demo-application-signed" |
| 59 | + path: "demo-application-signed" |
| 60 | + if-no-files-found: error |
0 commit comments