Skip to content

Commit c35242a

Browse files
committed
docs: focus cicd docs on github actions
1 parent cfd4ddf commit c35242a

1 file changed

Lines changed: 100 additions & 78 deletions

File tree

docs/guides/platforms/ci-cd.md

Lines changed: 100 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,58 @@
11
# CI/CD Integration
22

3-
Sign release artifacts and verify commit signatures in CI pipelines. Auths uses a limited-capability device key model so your root identity never leaves your machine.
3+
Sign every commit. Verify every release. Auths uses a limited-capability device key model so your root identity never leaves your machine — the CI runner only ever holds a scoped, revocable token.
44

5-
## Concepts
5+
---
66

7-
CI signing in Auths works through device delegation:
7+
## GitHub Actions
88

9-
1. You create a **CI device key** on your local machine.
10-
2. You **link** that device to your identity with restricted capabilities (e.g., `sign_release` only).
11-
3. The device key and a snapshot of your identity repository are packaged as GitHub Secrets.
12-
4. In CI, the runner restores the identity bundle and signs artifacts using the CI device key.
13-
5. You can **revoke** the CI device at any time without affecting your root identity.
9+
The fastest path. Two actions, one secret, zero ongoing maintenance.
1410

15-
## One-time setup with `auths ci setup`
16-
17-
Run this from any repo with a git remote:
11+
### Setup (one-time)
1812

1913
```bash
2014
auths ci setup
2115
```
2216

23-
This command will:
17+
This creates a scoped CI device key, links it to your identity with `sign_release` capability, and sets `AUTHS_CI_TOKEN` on your repo via the `gh` CLI. If `gh` isn't authenticated, it prints the token value to paste in manually under **Repository → Settings → Secrets → Actions**.
18+
19+
### Sign commits
2420

25-
1. **Verify your identity exists** and read your identity DID and key alias.
26-
2. **Generate a CI device key** (Ed25519) and link it to your identity with `sign_release` capability.
27-
3. **Package everything** into a single `AUTHS_CI_TOKEN` JSON secret containing the passphrase, encrypted keychain, identity repo snapshot, and verification bundle.
28-
4. **Set the secret** on your forge automatically via the `gh` CLI (GitHub) or print the token for manual setup (other forges).
21+
Add to any workflow that pushes to `main`:
2922

30-
If the `gh` CLI is not authenticated, the command prints the token value for you to add manually via **Repository > Settings > Secrets > Actions > New secret**.
23+
```yaml
24+
- uses: auths-dev/sign@v1
25+
with:
26+
token: ${{ secrets.AUTHS_CI_TOKEN }}
27+
commits: 'HEAD~1..HEAD'
28+
```
3129
32-
### Rotating the token
30+
### Verify commits
3331
34-
To refresh the token (new TTL, updated identity repo) without regenerating the device key:
32+
Add to every pull request and push:
3533
36-
```bash
37-
auths ci rotate
34+
```yaml
35+
- uses: auths-dev/verify@v1
36+
with:
37+
fail-on-unsigned: true
38+
post-pr-comment: 'true'
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
3840
```
3941
40-
### Re-running setup
42+
No token needed — the action reads `.auths/allowed_signers` from your repo.
43+
44+
### Show it off
4145

42-
If you already have a `ci-release-device` key, `auths ci setup` detects it and reuses the existing key while regenerating the token.
46+
Once both workflows are running, add badges to your README:
4347

44-
## Signing artifacts in GitHub Actions
48+
```markdown
49+
[![Verify Commits](https://github.com/<org>/<repo>/actions/workflows/verify-commits.yml/badge.svg)](https://github.com/<org>/<repo>/actions/workflows/verify-commits.yml?query=branch%3Amain+event%3Apush)
50+
[![Sign Commits](https://github.com/<org>/<repo>/actions/workflows/sign-commits.yml/badge.svg)](https://github.com/<org>/<repo>/actions/workflows/sign-commits.yml?query=branch%3Amain)
51+
```
4552

46-
Once `AUTHS_CI_TOKEN` is set, add a signing step to your release workflow:
53+
### Sign release artifacts
54+
55+
For releases triggered by a tag push, combine signing with your existing build step:
4756

4857
```yaml
4958
name: Release
@@ -60,10 +69,10 @@ jobs:
6069
steps:
6170
- uses: actions/checkout@v4
6271
63-
- name: Build release artifact
72+
- name: Build
6473
run: cargo build --release && tar czf myproject.tar.gz -C target/release myproject
6574
66-
- name: Sign and verify artifact
75+
- name: Sign artifact
6776
uses: auths-dev/sign@v1
6877
with:
6978
token: ${{ secrets.AUTHS_CI_TOKEN }}
@@ -78,83 +87,104 @@ jobs:
7887
myproject.tar.gz.auths.json
7988
```
8089

81-
The `auths sign <file>` command detects that the target is a file (not a Git ref) and creates an attestation file at `<file>.auths.json` containing the cryptographic signature, the signer's DID, and the artifact digest.
90+
Signing produces `myproject.tar.gz.auths.json` alongside the artifact — ship both so downstream consumers can verify.
8291

83-
## Signing Git commits in CI
92+
### Rotating or revoking access
8493

85-
To sign Git commits (not just artifacts), configure Git to use Auths as the signing program:
94+
To refresh the token (new TTL, updated identity snapshot):
8695

87-
```yaml
88-
- name: Configure Git signing
89-
run: |
90-
git config --global gpg.format ssh
91-
git config --global gpg.ssh.program auths-sign
92-
git config --global commit.gpgsign true
93-
git config --global user.signingkey "$(auths key export --alias ci-release-device --format pub)"
96+
```bash
97+
auths ci rotate
9498
```
9599

96-
Then any `git commit` in the workflow will be signed by the CI device key.
100+
To revoke a CI device entirely:
97101

98-
## Verifying signatures in pipelines
102+
```bash
103+
auths device revoke --device <ci-device-did> --key <your-key>
104+
```
99105

100-
### Verifying commits
106+
After revocation the CI key can no longer produce valid attestations, even if the secret is still in GitHub.
101107

102-
Use `auths verify` to check commit signatures. For CI, the `--identity-bundle` flag enables stateless verification without needing access to the full identity repository:
108+
---
103109

104-
```bash
105-
# Export a bundle on your local machine (one-time)
106-
auths id export-bundle \
107-
--alias main \
108-
--output identity-bundle.json \
109-
--max-age-secs 7776000 # 90 days
110+
## Manual setup (other CI platforms)
111+
112+
Running GitLab CI, CircleCI, Bitbucket Pipelines, or your own runner? The same `AUTHS_CI_TOKEN` approach works anywhere you can set an environment variable and install a binary.
113+
114+
### Install the CLI
115+
116+
```yaml
117+
# Example: generic shell step
118+
- name: Install auths
119+
run: |
120+
curl -fsSL https://get.auths.dev | sh
121+
echo "$HOME/.auths/bin" >> $GITHUB_PATH # or equivalent PATH export
110122
```
111123

112-
Commit this bundle to your repository (e.g., `.auths/identity-bundle.json`), then verify in CI:
124+
### Sign commits
125+
126+
Configure Git to use Auths as the signing program, then any `git commit` in the workflow is signed:
113127

114128
```yaml
115-
- name: Verify commit signatures
116-
run: |
117-
auths verify HEAD --identity-bundle .auths/identity-bundle.json
129+
- name: Configure Git signing
130+
run: |
131+
git config --global gpg.format ssh
132+
git config --global gpg.ssh.program auths-sign
133+
git config --global commit.gpgsign true
134+
git config --global user.signingkey "$(auths key export --alias ci-release-device --format pub)"
118135
```
119136

120-
To verify a range of commits:
137+
### Sign artifacts
121138

122139
```bash
123-
auths verify main..HEAD --identity-bundle .auths/identity-bundle.json
140+
auths sign myproject.tar.gz
141+
# → creates myproject.tar.gz.auths.json
124142
```
125143

126-
The verify command checks:
144+
### Verify commits
127145

128-
1. **SSH signature validity** -- The commit has a valid SSH signature from an allowed signer.
129-
2. **Attestation chain** -- If the bundle contains attestations, the chain is verified (signatures, expiry, revocation).
130-
3. **Witness quorum** -- If witness receipts are provided, the required threshold is checked.
146+
For stateless verification (no access to the identity repo), export a bundle once locally and commit it:
131147

132-
Exit codes: `0` for valid, `1` for invalid/unsigned, `2` for errors.
148+
```bash
149+
# Local — one-time export
150+
auths id export-bundle \
151+
--alias main \
152+
--output .auths/identity-bundle.json \
153+
--max-age-secs 7776000 # 90 days
154+
git add .auths/identity-bundle.json && git commit -m "add identity bundle"
155+
```
133156

134-
### Verifying artifacts
157+
Then in CI:
135158

136-
Verify a signed artifact by passing the artifact file directly — `auths` finds the `.auths.json` sidecar automatically:
159+
```bash
160+
auths verify HEAD --identity-bundle .auths/identity-bundle.json
161+
```
162+
163+
To verify a PR range:
137164

138165
```bash
139-
auths verify myproject.tar.gz --signer-key <hex-encoded-public-key>
166+
auths verify main..HEAD --identity-bundle .auths/identity-bundle.json
140167
```
141168

142-
Or using the issuer's DID:
169+
### Verify artifacts
170+
171+
Pass the artifact file directly — Auths finds the `.auths.json` sidecar automatically:
143172

144173
```bash
174+
auths verify myproject.tar.gz --signer-key <hex-encoded-public-key>
175+
# or by DID
145176
auths verify myproject.tar.gz --signer did:keri:EaBcDeFg...
146177
```
147178

148-
You can also pass the attestation file directly, or override the sidecar path:
179+
Override the sidecar path with `--signature` if needed:
149180

150181
```bash
151-
auths verify myproject.tar.gz.auths.json --signer-key <hex-encoded-public-key>
152182
auths verify myproject.tar.gz --signature /path/to/custom.auths.json --signer-key <hex-encoded-public-key>
153183
```
154184

155-
### JSON output for CI parsing
185+
### Machine-readable output
156186

157-
Use `--json` for machine-readable verification output:
187+
Add `--json` to any verify command for structured output your pipeline can parse:
158188

159189
```bash
160190
auths verify HEAD --identity-bundle .auths/identity-bundle.json --json
@@ -170,6 +200,10 @@ auths verify HEAD --identity-bundle .auths/identity-bundle.json --json
170200
}
171201
```
172202

203+
Exit codes: `0` valid · `1` invalid/unsigned · `2` error.
204+
205+
---
206+
173207
## GitHub Actions OIDC cross-reference
174208

175209
For higher assurance, combine Auths attestation chains with GitHub Actions OIDC tokens. This creates a two-factor proof: the request must originate from both a valid KERI identity holder and a specific GitHub Actions workflow.
@@ -204,15 +238,3 @@ steps:
204238
```
205239

206240
The bridge verifies the KERI attestation chain, validates the GitHub OIDC token against GitHub's JWKS endpoint, and cross-references the GitHub `actor` claim against the expected KERI identity. If both pass, it issues a bridge JWT.
207-
208-
## Revoking CI access
209-
210-
To revoke a CI device at any time:
211-
212-
```bash
213-
auths device revoke \
214-
--device <ci-device-did> \
215-
--key <your-key>
216-
```
217-
218-
The device DID and identity key alias are printed by `auths ci setup` when the device is created. After revocation, the CI device key can no longer produce valid attestations, even if the secrets remain in GitHub.

0 commit comments

Comments
 (0)