CI/CD Integration
Restore your repo’s secret files in a pipeline with a read-only CI token and one command:
depvault pullWith DEPVAULT_TOKEN set, pull writes every file the token can read to its repo path, decrypted on the runner.
Replace “a whole .env in one CI secret”
A common pattern is pasting an entire .env into a single CI secret and writing it out at deploy time:
- run: echo "${{ secrets.DOCKER_ENV }}" > deploy/.envThe file has no history, no review, and drifts from what developers use. With DepVault, deploy/.env lives in the project like any other file (edited in the web app or pushed with the CLI), and the pipeline pulls it:
- uses: suxrobGM/depvault@v1
with:
token: ${{ secrets.DEPVAULT_TOKEN }}
- run: depvault pull deploy/.envCreate a token
- Open the project and go to Settings → CI/CD Tokens.
- Click Generate Token and fill in:
| Setting | Description |
|---|---|
| Token name | e.g. github-deploy. |
| Files | Path globs the token can read, matched from the repo root: deploy/**, apps/api/.env, or **/.env for every .env at any depth (.env alone is only the root file). Empty = every file. |
| Expires after | 1 hour to 1 year, or a custom date. |
| IP allowlist | Optional IPs or CIDR ranges (Team plan). |
- Unlock your vault if asked, generate, and copy the token. It is shown once, so store it as a secret in your CI provider (e.g.
DEPVAULT_TOKEN).
Revoke tokens from the same page; revoked tokens are rejected immediately. Last use is shown for each token. Give each pipeline its own narrowly scoped token.
How the token stays zero-knowledge
A token looks like dvci_<auth>.<key>. The server only ever sees the auth part; the key part stays in your pipeline and unwraps the project key locally, so DepVault can authenticate the token but never decrypt your files. Details on the Encryption & Security page.
depvault pull in CI
depvault pull # every file the token can read
depvault pull deploy/.env # only this file
depvault pull 'apps/api/**' # only matching files- Files are written under the folder holding
.depvault.json(so check out the repo first), or the current folder if there isn’t one. - No project ID, vault password, or login needed: the token determines the project.
- CI tokens are read-only:
push,status, and other commands refuse to run. - The command exits with code 1 if nothing matched or a file couldn’t be written.
--jsonprints the written paths. - The installers and the action verify the downloaded CLI against the release’s
SHA256SUMS. depvault scan --fail-on highchecks the checkout for leaked secrets without a token.
GitHub Actions
The suxrobGM/depvault action installs the CLI and sets DEPVAULT_TOKEN for later steps. It runs on Linux, macOS, and Windows runners (x64 and ARM64).
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: suxrobGM/depvault@v1
with:
token: ${{ secrets.DEPVAULT_TOKEN }}
- run: depvault pull
- run: npm ci && npm run build| Input | Description | Default |
|---|---|---|
version | CLI version to install (e.g. v1.1.0). | latest |
token | CI token; sets DEPVAULT_TOKEN. | None |
To expose a pulled .env to later steps as environment variables:
- run: cat apps/api/.env >> "$GITHUB_ENV"GitLab CI
Store DEPVAULT_TOKEN as a masked CI/CD variable.
deploy:
stage: deploy
image: node:20
before_script:
- curl -fsSL https://get.depvault.com | bash
script:
- depvault pull
- npm ci && npm run buildAzure DevOps
Store the token as a secret pipeline variable.
steps:
- script: curl -fsSL https://get.depvault.com | bash
displayName: Install DepVault CLI
- script: depvault pull
displayName: Restore secret files
env:
DEPVAULT_TOKEN: $(DEPVAULT_TOKEN)Windows without the action
- shell: pwsh
run: irm https://get.depvault.com | iex
- shell: pwsh
env:
DEPVAULT_TOKEN: ${{ secrets.DEPVAULT_TOKEN }}
run: depvault pullDocker builds
Don’t COPY restored secret files into an image, because they end up in its layers. Mount them as build secrets instead, or pass them at runtime (docker compose --env-file, env_file:):
depvault pull apps/api/.env
docker build --secret id=env,src=apps/api/.env -t myapp .FROM node:20-alpine AS build
WORKDIR /app
COPY . .
RUN --mount=type=secret,id=env,target=/app/.env npm run buildAdd the restored paths to .dockerignore so COPY . . can’t pick them up.
Troubleshooting
| Message | Fix |
|---|---|
This token can't read any files | The token’s Files globs match nothing. Check them in project settings. |
No files matched | The paths passed to pull are outside the token’s scope or don’t exist. |
CI tokens can only pull files | Only depvault pull works with a CI token. |
401 Unauthorized | Token expired, revoked, or mistyped. |
403 Forbidden | The runner’s IP isn’t in the token’s allowlist. |
not a valid CI token | Old or mistyped token. Generate a new one. |
CI token format not recognized | Old CLI. Run depvault update or use the latest action. |