From 9e1a5b2756615cf4cb5f4ff4c05e0589213f698a Mon Sep 17 00:00:00 2001 From: John Andersen Date: Tue, 12 Sep 2023 19:23:03 +0000 Subject: [PATCH] Example CI job for GitHub Actions OIDC authenticated notary Signed-off-by: John Andersen --- .github/workflows/notarize_reusable.yml | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/notarize_reusable.yml diff --git a/.github/workflows/notarize_reusable.yml b/.github/workflows/notarize_reusable.yml new file mode 100644 index 00000000..15d1d321 --- /dev/null +++ b/.github/workflows/notarize_reusable.yml @@ -0,0 +1,77 @@ +name: "SCITT Notary" + +on: + push: + branches: + - main + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' + workflow_dispatch: + inputs: + scitt-url: + description: 'URL of SCITT instance' + default: "http://localhost:8080" + type: string + payload: + description: 'Payload for claim' + default: '{"key": "value"}' + type: string + workflow_call: + inputs: + scitt-url: + description: 'URL of SCITT instance' + default: "http://localhost:8080" + type: string + payload: + description: 'Payload for claim' + type: string + +jobs: + notarize: + runs-on: ubuntu-latest + env: + SCITT_URL: '${{ inputs.scitt-url || github.event.inputs.scitt-url }}' + PAYLOAD: '${{ inputs.payload || github.event.inputs.payload }}' + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install SCITT API Emulator + run: | + pip install -U pip setuptools wheel + pip install .[oidc] + - name: Get OIDC token to use as bearer token for auth to SCITT + uses: actions/github-script@v6 + id: github-oidc + with: + script: | + const {SCITT_URL} = process.env; + const coredemo = require('@actions/core'); + coredemo.setOutput('token', await coredemo.getIDToken(SCITT_URL)); + - name: Create claim + run: | + scitt-emulator client create-claim --issuer did:web:example.org --content-type application/json --payload "${PAYLOAD}" --out claim.cose + - name: Submit claim + env: + OIDC_TOKEN: '${{ steps.github-oidc.outputs.token }}' + run: | + # Create the middleware config file + cat > oidc-middleware-config.json <