From 362736a85a7ceb7cc0721b73bdb74a53f0ce88c7 Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Wed, 17 Jan 2024 20:21:48 -0800 Subject: [PATCH] use env secrets in codegen step --- .github/workflows/deploy.yml | 5 +++-- Dockerfile | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bf97ea9..d7b8cf6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,7 @@ on: branches: - main - develop - pull_request: {} + # pull_request: {} jobs: # typecheck: # name: Check Types @@ -31,7 +31,7 @@ jobs: name: Deploy runs-on: ubuntu-latest # needs: typecheck - if: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') && github.event_name == 'push' }} + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.11.0 @@ -59,6 +59,7 @@ jobs: name: Post-Deployment Tasks runs-on: ubuntu-latest needs: deploy + if: ${{ github.ref == 'refs/heads/main' }} steps: - name: Purge Cloudflare Cache uses: jakejarvis/cloudflare-purge-action@master diff --git a/Dockerfile b/Dockerfile index 29eb511..837964f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,17 +26,19 @@ RUN npm install --include=dev # Copy application code COPY --link . . +# Create environment file +RUN --mount=type=secret,id=dotenv,dst=env \ + tr ' ' '\n' < env > .env + +# Generate code RUN npm run codegen # Build application -RUN --mount=type=secret,id=dotenv,dst=env \ - tr ' ' '\n' < env > .env && \ - npm run build +RUN npm run build # Remove development dependencies RUN npm prune --omit=dev - # Final stage for app image FROM base