name: Approve Exact Release # No schedule, release trigger or PR token. Repository administrators must first # protect main and release-approval, then explicitly enable the repository var. # This produces a signature only: it never uploads release assets or writes a feed. on: workflow_dispatch: inputs: version: description: Exact previously tested version (without v) required: true type: string manifest_sha256: description: SHA-256 from the independently reviewed candidate evidence required: true type: string source_commit: description: Reviewed full source SHA required: true type: string candidate_commit: description: Tested full candidate SHA required: true type: string permissions: {} concurrency: group: release-approval cancel-in-progress: false jobs: approve: if: >- github.repository == 'HKUDS/nanobot' && github.ref == 'refs/heads/main' && vars.NANOBOT_RELEASE_SIGNING_ENABLED == 'true' environment: release-approval runs-on: ubuntu-latest timeout-minutes: 10 permissions: contents: read id-token: write env: RELEASE_VERSION: ${{ inputs.version }} MANIFEST_SHA256: ${{ inputs.manifest_sha256 }} SOURCE_COMMIT: ${{ inputs.source_commit }} CANDIDATE_COMMIT: ${{ inputs.candidate_commit }} steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: python-version: '3.11' - name: Install hash-locked signing tools, not the candidate run: | python -m pip install --require-hashes --only-binary=:all: -r .github/release-signing-requirements.txt - name: Fetch only the proposed manifest env: GH_TOKEN: ${{ github.token }} run: | [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(\.dev[0-9]+|\.post[0-9]+)?$ ]] gh release download "v$RELEASE_VERSION" --repo "$GITHUB_REPOSITORY" \ --pattern release-manifest.json --dir "$RUNNER_TEMP/approval" - name: Bind the signature to reviewed evidence run: | python -m scripts.verify_release_approval \ --manifest "$RUNNER_TEMP/approval/release-manifest.json" \ --sha256 "$MANIFEST_SHA256" --version "$RELEASE_VERSION" \ --source-commit "$SOURCE_COMMIT" --candidate-commit "$CANDIDATE_COMMIT" - name: Sign and verify the exact manifest run: | python -m sigstore sign --no-default-files \ --bundle "$RUNNER_TEMP/approval/release-manifest.json.sigstore.json" \ "$RUNNER_TEMP/approval/release-manifest.json" python -m sigstore verify identity \ --cert-identity 'https://github.com/HKUDS/nanobot/.github/workflows/release-approve.yml@refs/heads/main' \ --cert-oidc-issuer 'https://token.actions.githubusercontent.com' \ --bundle "$RUNNER_TEMP/approval/release-manifest.json.sigstore.json" \ "$RUNNER_TEMP/approval/release-manifest.json" - name: Retain small approval proof for the separate publication handoff uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: release-approval-${{ github.run_id }}-${{ github.run_attempt }} path: ${{ runner.temp }}/approval/* if-no-files-found: error retention-days: 3