I had many environmental variables so I used to gpg to encrypt those variables in a file.
I then made a script to decrypt that file and to store it the backend folder of my project during the run of the action
All this are to happen in the github action (see below the yml file)
That script of mine looks something like this:
#!/bin/sh
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPTER_PASSPHRASE" \
--output ./backend/.env ./.github/secrets/backend.env.gpg
My script is running well when I am executing this command in the project root
./.github/scripts/backend_decrypt.sh
But it fails during the github action
My backend-deploy.yml
file is like this:
name: Backend Deploy
on:
push:
branches:
- master
paths:
- 'backend/**'
jobs:
backendDeploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- shell: bash
env:
DECRYPTER_PASSPHRASE: ${{secrets.DECRYPTER_PASSPHRASE}}
run: >
./.github/scripts/backend_decrypt.sh
# fails at this point
- run: |
cat backend/.env
pwd
ls -a
ls backend/
- run: >
ls -a
ls -a backend/
echo "Deployed to code-rush-backend.herokuapp.com"
It is giving me this error: