Skip to content

GitHub Action

Install and use dotsecenv in GitHub Actions workflows to securely access secrets in CI/CD pipelines.

  1. Create a workflow file

    Create .github/workflows/build.yml in your repository:

    name: Build
    on:
    push:
    branches: [main]
    pull_request:
    branches: [main]
    jobs:
    build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
  2. Add the dotsecenv action

    Add the dotsecenv/dotsecenv action to install dotsecenv:

    - uses: dotsecenv/dotsecenv@v0

    This downloads the latest release, verifies its integrity (GPG signature, checksums, and attestations), and adds it to your PATH.

  3. Configure initialization (optional)

    If your workflow needs a dotsecenv configuration, use the init-config input:

    - uses: dotsecenv/dotsecenv@v0
    with:
    init-config: '' # Initialize with a default config
  4. Use dotsecenv in subsequent steps

    Once installed, dotsecenv is available in all subsequent steps:

    - name: Use secrets
    run: |
    dotsecenv version
    # Your commands that use dotsecenv
  5. Complete workflow example

    Here’s a complete workflow:

    name: Build
    on:
    push:
    branches: [main]
    pull_request:
    branches: [main]
    jobs:
    build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dotsecenv/dotsecenv@v0
    with:
    init-config: ''
    - name: Build with secrets
    run: |
    dotsecenv version
    # dotsecenv secret get YOUR_SECRET | ...

After the workflow runs:

  • dotsecenv is installed and available in PATH
  • The dotsecenv version command succeeds
  • Subsequent steps can use dotsecenv commands

You should see output like this in your workflow logs:

dotsecenv version vX.X.X (commit: abc1234)

Pin to a specific version for reproducible builds:

- uses: dotsecenv/dotsecenv@v0
with:
version: v0.1.0

The version input accepts:

  • Release tags: v0.1.0, v1.2.3
  • Branch refs: main, develop
  • Commit SHAs: abc1234def5678...
  • Latest: latest (default) — resolves to the most recent release

Build dotsecenv from source instead of using pre-built binaries:

- uses: dotsecenv/dotsecenv@v0
with:
build-from-source: true

This is useful for:

  • Custom builds or modifications
  • Unsupported architectures
  • Auditing the build process

The init-config input controls whether dotsecenv init config runs after installation:

Don’t initialize a configuration file:

- uses: dotsecenv/dotsecenv@v0
# init-config defaults to 'skip' (which means, it won't be run)

By default, the action verifies GPG signatures, checksums, and attestations. To disable this (not recommended):

- uses: dotsecenv/dotsecenv@v0
with:
verify-provenance: false

Run on both Ubuntu and macOS:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dotsecenv/dotsecenv@v0
- run: dotsecenv version

The action automatically detects the runner’s OS and architecture.

The action provides outputs you can use in subsequent steps:

- uses: dotsecenv/dotsecenv@v0
id: dotsecenv
- name: Show installed version
run: |
echo "Installed version: ${{ steps.dotsecenv.outputs.version }}"
echo "Binary path: ${{ steps.dotsecenv.outputs.binary-path }}"
OutputDescription
versionThe installed dotsecenv version (e.g., v0.1.0)
binary-pathFull path to the installed binary

”Unsupported OS” or “Unsupported arch” error

Section titled “”Unsupported OS” or “Unsupported arch” error”

The action supports:

  • OS: Linux, macOS
  • Architecture: x86_64 (X64), arm64 (ARM64)

Windows is currently being implemented, but is not supported yet (see #8).

If GPG verification fails:

  1. Ensure your workflow has network access to get.dotsecenv.com
  2. Check if there’s a key rotation announcement in the dotsecenv releases
  3. As a last resort, use verify-provenance: false (not recommended)

Attestation verification requires the gh CLI and GITHUB_TOKEN. Ensure your workflow has:

permissions:
contents: read
id-token: write # Required for attestation verification