From 4cb1f99a87a69e1472dfab355072f2115e914b6e Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 17:06:41 -0800 Subject: [PATCH 1/7] Split/refactor workflows & create actions --- .github/actions/build-and-deploy/action.yml | 29 ++++++++ .../checkout-and-setup-pnpm/action.yml | 30 ++++++++ .github/workflows/build-and-deploy.yml | 74 ------------------- .github/workflows/clean-up-pr.yml | 61 --------------- .github/workflows/deploy-prod.yml | 33 +++++++++ .github/workflows/deploy-staging.yml | 37 ++++++++++ .github/workflows/lint.yml | 29 +------- .github/workflows/remove-staging.yml | 36 +++++++++ 8 files changed, 167 insertions(+), 162 deletions(-) create mode 100644 .github/actions/build-and-deploy/action.yml create mode 100644 .github/actions/checkout-and-setup-pnpm/action.yml delete mode 100644 .github/workflows/build-and-deploy.yml delete mode 100644 .github/workflows/clean-up-pr.yml create mode 100644 .github/workflows/deploy-prod.yml create mode 100644 .github/workflows/deploy-staging.yml create mode 100644 .github/workflows/remove-staging.yml diff --git a/.github/actions/build-and-deploy/action.yml b/.github/actions/build-and-deploy/action.yml new file mode 100644 index 00000000..572c2570 --- /dev/null +++ b/.github/actions/build-and-deploy/action.yml @@ -0,0 +1,29 @@ +name: Build and deploy PeterPortal +inputs: + DATABASE_URL: + description: Postgres database URL (different URLs for prod/dev) + required: true + NODE_ENV: + description: Node environment, either "production" or "staging" + required: true + stage: + description: Stage name, e.g. "prod" or "staging-123" + required: true +runs: + using: composite + steps: + - name: Build and deploy + run: pnpm sst deploy --stage ${{ inputs.stage }} + env: + PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }} + DATABASE_URL: ${{ inputs.DATABASE_URL }} + SESSION_SECRET: ${{ secrets.SESSION_SECRET }} + GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }} + GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} + GRECAPTCHA_SECRET: ${{ secrets.GRECAPTCHA_SECRET }} + ADMIN_EMAILS: ${{ secrets.ADMIN_EMAILS }} + PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + NODE_ENV: ${{ inputs.NODE_ENV }} + ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }} diff --git a/.github/actions/checkout-and-setup-pnpm/action.yml b/.github/actions/checkout-and-setup-pnpm/action.yml new file mode 100644 index 00000000..0a302ab1 --- /dev/null +++ b/.github/actions/checkout-and-setup-pnpm/action.yml @@ -0,0 +1,30 @@ +name: Checkout and Install pnpm +runs: + using: composite + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 9 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml deleted file mode 100644 index b8a11908..00000000 --- a/.github/workflows/build-and-deploy.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Build and deploy - -on: - push: - branches: - - main - pull_request: - types: - - opened - - reopened - - synchronize - -# do not cancel in progress, SST will be stuck in a "locked" state if cancelled mid-deployment -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - -jobs: - build_and_deploy: - name: Build and deploy PeterPortal - runs-on: ubuntu-latest - if: (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'no deploy')) - environment: - name: ${{ (github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number)) || 'production' }} - url: https://${{ (github.event_name == 'pull_request' && format('staging-{0}.', github.event.pull_request.number)) || '' }}peterportal.org - - steps: - - name: Check Out Repo - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v3 - name: Install pnpm - with: - version: 9 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install Dependencies - run: pnpm install - env: - HUSKY: 0 - - - name: Build and deploy - run: pnpm sst deploy --stage ${{ (github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number)) || 'prod' }} - env: - CI: false - PUBLIC_API_URL: ${{secrets.PUBLIC_API_URL}} - DATABASE_URL: ${{ github.event_name == 'pull_request' && secrets.DEV_DATABASE_URL || secrets.PROD_DATABASE_URL }} - SESSION_SECRET: ${{secrets.SESSION_SECRET}} - GOOGLE_CLIENT: ${{secrets.GOOGLE_CLIENT}} - GOOGLE_SECRET: ${{secrets.GOOGLE_SECRET}} - GRECAPTCHA_SECRET: ${{secrets.GRECAPTCHA_SECRET}} - ADMIN_EMAILS: ${{secrets.ADMIN_EMAILS}} - PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - NODE_ENV: ${{ github.event_name == 'pull_request' && 'staging' || 'production' }} - ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }} diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml deleted file mode 100644 index d25d107d..00000000 --- a/.github/workflows/clean-up-pr.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Clean up PR - -on: - pull_request: - types: [closed] - -# use pr number for group instead of github.ref because ref will be main branch when the PR closes which is not a unique group for the PR -concurrency: - group: ${{ github.workflow }}-pr-${{ github.event.pull_request.number }} - cancel-in-progress: true - -jobs: - clean-up-pr: - runs-on: ubuntu-latest - - steps: - - name: Check Out Repo - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v3 - name: Install pnpm - with: - version: 9 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install Dependencies - run: pnpm install - env: - HUSKY: 0 - - - name: Remove staging stack - run: pnpm sst remove --stage staging-${{ github.event.pull_request.number }} - env: - CI: false - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - - name: Deactivate deployment - uses: strumwolf/delete-deployment-environment@v3.0.0 - with: - environment: staging-${{ github.event.pull_request.number }} - token: ${{ secrets.GITHUB_TOKEN }} - onlyDeactivateDeployments: true diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 00000000..11bebf14 --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,33 @@ +name: Deploy production + +on: + push: + branches: + - main + +# do not cancel in progress, SST will be stuck in a "locked" state if cancelled mid-deployment +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + build_and_deploy: + name: Build and deploy + runs-on: ubuntu-latest + environment: + name: production + url: https://peterportal.org + steps: + - name: Checkout and setup pnpm + uses: ./.github/actions/checkout-and-setup-pnpm + + - name: Install dependencies + run: pnpm install + env: + HUSKY: 0 + + - name: Build and deploy + uses: ./.github/actions/build-and-deploy + with: + NODE_ENV: production + stage: prod + DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }} diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml new file mode 100644 index 00000000..8714f481 --- /dev/null +++ b/.github/workflows/deploy-staging.yml @@ -0,0 +1,37 @@ +name: Deploy staging + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +# do not cancel in progress, SST will be stuck in a "locked" state if cancelled mid-deployment +concurrency: + group: staging-${{ github.event.pull_request.number }} + +jobs: + build_and_deploy: + name: Build and deploy + runs-on: ubuntu-latest + # don't run if labeled "no deploy" && don't run on PRs from forks + if: (!contains(github.event.pull_request.labels.*.name, 'no deploy')) && github.event.pull_request.head.repo.full_name == github.repository + environment: + name: staging-${{ github.event.pull_request.number }} + url: https://staging-${{ github.event.pull_request.number }}peterportal.org + steps: + - name: Checkout and setup pnpm + uses: ./.github/actions/checkout-and-setup-pnpm + + - name: Install dependencies + run: pnpm install + env: + HUSKY: 0 + + - name: Build and deploy + uses: ./.github/actions/build-and-deploy + with: + NODE_ENV: staging + stage: staging-${{ github.event.pull_request.number }} + DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea0aec03..abef752b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,34 +15,9 @@ jobs: lint: name: Lint and check formatting runs-on: ubuntu-latest - steps: - - name: Check Out Repo - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v3 - name: Install pnpm - with: - version: 9 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + - name: Checkout and setup pnpm + uses: ./.github/actions/checkout-and-setup-pnpm - name: Install Dependencies run: pnpm install diff --git a/.github/workflows/remove-staging.yml b/.github/workflows/remove-staging.yml new file mode 100644 index 00000000..9f39df7f --- /dev/null +++ b/.github/workflows/remove-staging.yml @@ -0,0 +1,36 @@ +name: Remove staging + +on: + pull_request: + types: + - closed + +# use pr number for group instead of github.ref because ref will be main branch when the PR closes which is not a unique group for the PR +# group should match with deploy-staging workflow so those don't run concurrently (if someone closes/reopens a PR) +concurrency: + group: staging-${{ github.event.pull_request.number }} + +jobs: + clean-up-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout and setup pnpm + uses: ./.github/actions/checkout-and-setup-pnpm + + - name: Install Dependencies + run: pnpm install + env: + HUSKY: 0 + + - name: Remove staging + run: pnpm sst remove --stage staging-${{ github.event.pull_request.number }} + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Deactivate deployment + uses: strumwolf/delete-deployment-environment@v3.0.0 + with: + environment: staging-${{ github.event.pull_request.number }} + token: ${{ secrets.GITHUB_TOKEN }} + onlyDeactivateDeployments: true From ea4fdba0784078a34d030a484894100c0fa9c677 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 17:10:34 -0800 Subject: [PATCH 2/7] Update db url for staging, reorder env vars --- .github/actions/build-and-deploy/action.yml | 5 +++-- .github/workflows/deploy-staging.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-and-deploy/action.yml b/.github/actions/build-and-deploy/action.yml index 572c2570..eae2ca49 100644 --- a/.github/actions/build-and-deploy/action.yml +++ b/.github/actions/build-and-deploy/action.yml @@ -15,8 +15,10 @@ runs: - name: Build and deploy run: pnpm sst deploy --stage ${{ inputs.stage }} env: - PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }} DATABASE_URL: ${{ inputs.DATABASE_URL }} + NODE_ENV: ${{ inputs.NODE_ENV }} + + PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }} SESSION_SECRET: ${{ secrets.SESSION_SECRET }} GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }} GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} @@ -25,5 +27,4 @@ runs: PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - NODE_ENV: ${{ inputs.NODE_ENV }} ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }} diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 8714f481..a60e0a22 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -34,4 +34,4 @@ jobs: with: NODE_ENV: staging stage: staging-${{ github.event.pull_request.number }} - DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }} + DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }} From ce40f68f1ce2d887d197d9e4ffaf9dc4d1b9971b Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 17:32:18 -0800 Subject: [PATCH 3/7] Add remove staging fork condition --- .github/workflows/remove-staging.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/remove-staging.yml b/.github/workflows/remove-staging.yml index 9f39df7f..11a2d899 100644 --- a/.github/workflows/remove-staging.yml +++ b/.github/workflows/remove-staging.yml @@ -13,6 +13,8 @@ concurrency: jobs: clean-up-pr: runs-on: ubuntu-latest + # don't run on PRs from forks + if: github.event.pull_request.head.repo.full_name == github.repository steps: - name: Checkout and setup pnpm uses: ./.github/actions/checkout-and-setup-pnpm From b2f41851c685ac6204a06493a42f42b531873124 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 17:34:25 -0800 Subject: [PATCH 4/7] Add checkout step first --- .../{checkout-and-setup-pnpm => setup-pnpm}/action.yml | 3 --- .github/workflows/deploy-prod.yml | 7 +++++-- .github/workflows/deploy-staging.yml | 7 +++++-- .github/workflows/lint.yml | 7 +++++-- .github/workflows/remove-staging.yml | 7 +++++-- 5 files changed, 20 insertions(+), 11 deletions(-) rename .github/actions/{checkout-and-setup-pnpm => setup-pnpm}/action.yml (91%) diff --git a/.github/actions/checkout-and-setup-pnpm/action.yml b/.github/actions/setup-pnpm/action.yml similarity index 91% rename from .github/actions/checkout-and-setup-pnpm/action.yml rename to .github/actions/setup-pnpm/action.yml index 0a302ab1..d0c5d497 100644 --- a/.github/actions/checkout-and-setup-pnpm/action.yml +++ b/.github/actions/setup-pnpm/action.yml @@ -2,9 +2,6 @@ name: Checkout and Install pnpm runs: using: composite steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Install Node.js uses: actions/setup-node@v4 with: diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 11bebf14..9b77e73b 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -17,8 +17,11 @@ jobs: name: production url: https://peterportal.org steps: - - name: Checkout and setup pnpm - uses: ./.github/actions/checkout-and-setup-pnpm + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: ./.github/actions/setup-pnpm - name: Install dependencies run: pnpm install diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index a60e0a22..c17e86fb 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -21,8 +21,11 @@ jobs: name: staging-${{ github.event.pull_request.number }} url: https://staging-${{ github.event.pull_request.number }}peterportal.org steps: - - name: Checkout and setup pnpm - uses: ./.github/actions/checkout-and-setup-pnpm + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: ./.github/actions/setup-pnpm - name: Install dependencies run: pnpm install diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index abef752b..b35febac 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,8 +16,11 @@ jobs: name: Lint and check formatting runs-on: ubuntu-latest steps: - - name: Checkout and setup pnpm - uses: ./.github/actions/checkout-and-setup-pnpm + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: ./.github/actions/setup-pnpm - name: Install Dependencies run: pnpm install diff --git a/.github/workflows/remove-staging.yml b/.github/workflows/remove-staging.yml index 11a2d899..0165c1cd 100644 --- a/.github/workflows/remove-staging.yml +++ b/.github/workflows/remove-staging.yml @@ -16,8 +16,11 @@ jobs: # don't run on PRs from forks if: github.event.pull_request.head.repo.full_name == github.repository steps: - - name: Checkout and setup pnpm - uses: ./.github/actions/checkout-and-setup-pnpm + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: ./.github/actions/setup-pnpm - name: Install Dependencies run: pnpm install From c964e0910cfe4f1e2560c82a0021d63c4490f8a2 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 17:38:02 -0800 Subject: [PATCH 5/7] Fix deploy workflows --- .github/actions/build-and-deploy/action.yml | 30 --------------------- .github/workflows/deploy-prod.yml | 18 ++++++++++--- .github/workflows/deploy-staging.yml | 18 ++++++++++--- 3 files changed, 28 insertions(+), 38 deletions(-) delete mode 100644 .github/actions/build-and-deploy/action.yml diff --git a/.github/actions/build-and-deploy/action.yml b/.github/actions/build-and-deploy/action.yml deleted file mode 100644 index eae2ca49..00000000 --- a/.github/actions/build-and-deploy/action.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build and deploy PeterPortal -inputs: - DATABASE_URL: - description: Postgres database URL (different URLs for prod/dev) - required: true - NODE_ENV: - description: Node environment, either "production" or "staging" - required: true - stage: - description: Stage name, e.g. "prod" or "staging-123" - required: true -runs: - using: composite - steps: - - name: Build and deploy - run: pnpm sst deploy --stage ${{ inputs.stage }} - env: - DATABASE_URL: ${{ inputs.DATABASE_URL }} - NODE_ENV: ${{ inputs.NODE_ENV }} - - PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }} - SESSION_SECRET: ${{ secrets.SESSION_SECRET }} - GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }} - GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} - GRECAPTCHA_SECRET: ${{ secrets.GRECAPTCHA_SECRET }} - ADMIN_EMAILS: ${{ secrets.ADMIN_EMAILS }} - PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }} diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 9b77e73b..a74d9617 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -29,8 +29,18 @@ jobs: HUSKY: 0 - name: Build and deploy - uses: ./.github/actions/build-and-deploy - with: - NODE_ENV: production - stage: prod + run: pnpm sst deploy --stage prod + env: DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }} + NODE_ENV: production + + PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }} + SESSION_SECRET: ${{ secrets.SESSION_SECRET }} + GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }} + GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} + GRECAPTCHA_SECRET: ${{ secrets.GRECAPTCHA_SECRET }} + ADMIN_EMAILS: ${{ secrets.ADMIN_EMAILS }} + PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }} diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index c17e86fb..0d0959f9 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -33,8 +33,18 @@ jobs: HUSKY: 0 - name: Build and deploy - uses: ./.github/actions/build-and-deploy - with: - NODE_ENV: staging - stage: staging-${{ github.event.pull_request.number }} + run: pnpm sst deploy --stage staging-${{ github.event.pull_request.number }} + env: DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }} + NODE_ENV: staging + + PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }} + SESSION_SECRET: ${{ secrets.SESSION_SECRET }} + GOOGLE_CLIENT: ${{ secrets.GOOGLE_CLIENT }} + GOOGLE_SECRET: ${{ secrets.GOOGLE_SECRET }} + GRECAPTCHA_SECRET: ${{ secrets.GRECAPTCHA_SECRET }} + ADMIN_EMAILS: ${{ secrets.ADMIN_EMAILS }} + PRODUCTION_DOMAIN: ${{ secrets.PRODUCTION_DOMAIN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }} From fc72997cb3442fc0dceb08209505e9e3c704cfb6 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 17:38:53 -0800 Subject: [PATCH 6/7] Rename setup pnpm action --- .github/actions/setup-pnpm/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-pnpm/action.yml b/.github/actions/setup-pnpm/action.yml index d0c5d497..41137e7b 100644 --- a/.github/actions/setup-pnpm/action.yml +++ b/.github/actions/setup-pnpm/action.yml @@ -1,4 +1,4 @@ -name: Checkout and Install pnpm +name: Setup pnpm runs: using: composite steps: From 83f6243a36f4497d69b5f42f7ece59881ac4533d Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Fri, 6 Dec 2024 18:06:21 -0800 Subject: [PATCH 7/7] Missing . in environment url --- .github/workflows/deploy-staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 0d0959f9..0edc4a30 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -19,7 +19,7 @@ jobs: if: (!contains(github.event.pull_request.labels.*.name, 'no deploy')) && github.event.pull_request.head.repo.full_name == github.repository environment: name: staging-${{ github.event.pull_request.number }} - url: https://staging-${{ github.event.pull_request.number }}peterportal.org + url: https://staging-${{ github.event.pull_request.number }}.peterportal.org steps: - name: Checkout repo uses: actions/checkout@v4