Created
June 5, 2022 14:23
-
-
Save Kahtaf/63b8e6ec7df32f3c0829b9e2e6d1af53 to your computer and use it in GitHub Desktop.
Github Actions - Download secret note from BitWarden - Great for storing .env files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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