Merge pull request 'FIX: Secret ENV_PRODUCTION colado direto no script bash quebrava com $ dentro do conteudo' (#3) from dev into master
All checks were successful
Deploy production / Deploy to production VM (push) Successful in 45s

Reviewed-on: #3
This commit is contained in:
Rafael Alves Lopes 2026-07-15 14:02:26 -03:00
commit b16a420fab

View File

@ -29,9 +29,11 @@ jobs:
- name: Check required secrets - name: Check required secrets
shell: bash shell: bash
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
run: | run: |
set -euo pipefail set -euo pipefail
if [ -z "${{ secrets.ENV_PRODUCTION }}" ]; then if [ -z "${ENV_PRODUCTION:-}" ]; then
echo "Missing secret ENV_PRODUCTION. Configure it in Settings > Actions > Secrets before deploying." echo "Missing secret ENV_PRODUCTION. Configure it in Settings > Actions > Secrets before deploying."
exit 1 exit 1
fi fi
@ -44,11 +46,13 @@ jobs:
- name: Write .env.production from secret - name: Write .env.production from secret
shell: bash shell: bash
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
run: | run: |
set -euo pipefail set -euo pipefail
DEPLOY_PATH="${PROD_DEPLOY_PATH:-/opt/sn-glpi-sync-new}" DEPLOY_PATH="${PROD_DEPLOY_PATH:-/opt/sn-glpi-sync-new}"
mkdir -p "$DEPLOY_PATH" mkdir -p "$DEPLOY_PATH"
printf '%s\n' "${{ secrets.ENV_PRODUCTION }}" > "$DEPLOY_PATH/.env.production" printf '%s\n' "$ENV_PRODUCTION" > "$DEPLOY_PATH/.env.production"
chmod 600 "$DEPLOY_PATH/.env.production" chmod 600 "$DEPLOY_PATH/.env.production"
- name: Deploy files and restart PM2 - name: Deploy files and restart PM2