FIX: Secret ENV_PRODUCTION colado direto no script bash quebrava com $ dentro do conteudo #3

Merged
rafael.lopes merged 1 commits from dev into master 2026-07-15 14:02:26 -03:00
Showing only changes of commit e838081aae - Show all commits

View File

@ -29,9 +29,11 @@ jobs:
- name: Check required secrets
shell: bash
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
run: |
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."
exit 1
fi
@ -44,11 +46,13 @@ jobs:
- name: Write .env.production from secret
shell: bash
env:
ENV_PRODUCTION: ${{ secrets.ENV_PRODUCTION }}
run: |
set -euo pipefail
DEPLOY_PATH="${PROD_DEPLOY_PATH:-/opt/sn-glpi-sync-new}"
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"
- name: Deploy files and restart PM2