Skip to content

Instantly share code, notes, and snippets.

@Kahtaf
Created June 5, 2022 14:23
Show Gist options
  • Save Kahtaf/63b8e6ec7df32f3c0829b9e2e6d1af53 to your computer and use it in GitHub Desktop.
Save Kahtaf/63b8e6ec7df32f3c0829b9e2e6d1af53 to your computer and use it in GitHub Desktop.
Github Actions - Download secret note from BitWarden - Great for storing .env files
jobs:
...
steps:
...
- name: Download .env from BitWarden
env:
# Client ID and Secret can be found in https://vault.bitwarden.com/#/settings/security/security-keys
BW_CLIENTID: ${{ secrets.BITWARDEN_CLIENTID }}
BW_CLIENTSECRET: ${{ secrets.BITWARDEN_CLIENTSECRET }}
# BitWarden master password required for unlocking vault
BW_PASSWORD: ${{ secrets.BITWARDEN_MASTER_PASSWORD }}
run: |
npm install -g @bitwarden/cli
bw login --apikey
BW_SESSION=$(bw unlock --passwordenv BW_PASSWORD --raw)
bw get item "production.env" --session $BW_SESSION | jq -r ".notes" > .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment