-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (36 loc) · 1.18 KB
/
good_pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Secure CI/CD Pipeline with Doppler
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v1
with:
token: ${{ secrets.DOPPLER_TOKEN }}
- name: Load Secrets into Environment
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
run: |
doppler secrets download --no-file --format env > secrets.env
set -o allexport
source secrets.env
set +o allexport
- name: Use Secrets Securely
run: |
echo "Building application with a hidden secret..."
echo "SECRET_KEY is set, but it won't appear in logs!"
export DATABASE_URL="postgresql://user:$SECRET_KEY@localhost:5432/mydatabase"
echo "Connecting to the database using the secret!"
if [ -f "./run_database_migrations.sh" ]; then
./run_database_migrations.sh --db-url=$DATABASE_URL
else
echo "Migration script not found. Skipping migrations."
fi
env:
SECRET_KEY: $SECRET_KEY