Closed dschinkel closed 3 years ago
Answer
Setup environment variables in your Github Actions workflow yaml that point to your secrets
env: #
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_SCHEMA_NAME: ${{ secrets.DB_SCHEMA_NAME }}
Have db-migrate pick them up:
"prod": {
"driver": "pg",
"addIfNotExists": {
"ssl": false
},
"user":{"ENV": "DB_USER"},
"password": {"ENV": "DB_PASS"},
"host": {"ENV": "DB_HOST"},
"database": {"ENV": "DB_NAME"},
"port": {"ENV": "DB_PORT"},
"schema": {"ENV": "DB_SCHEMA_NAME"}
},
database.json
When I run this during my CI pipeline from my Github Workflow yml, I get no errors:
node node_modules/db-migrate/bin/db-migrate up:production -config database.json -e prod
But when I look at the prod database, I see no migrations table and the migrations have not been applied.
How do I properly reference github secrets? I assumed this would work but it appears not to, and also appears I get no error either way (I expected an error if it can't connect to my DB) to tell me if it can even find these environment variables successfully.