From 14c1fa1910ef99dc292d3d7af2a5f99deae91cd8 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Tue, 6 Feb 2024 16:58:34 -0800 Subject: [PATCH 1/9] Actions stuff --- .github/workflows/build-and-deploy.yml | 10 ++++++++-- .github/workflows/clean-up-pr.yml | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index c9d4ab12..d45204b7 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -12,6 +12,10 @@ 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}.peterportal.org', github.event.pull_request.number)) || 'peterportal.org' }} concurrency: group: build-${{ github.head_ref || github.run_id }} @@ -19,16 +23,18 @@ jobs: steps: - name: Check Out Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' - name: Install Dependencies run: npm install + env: + HUSKY: 0 - name: Build and deploy run: npx sst deploy --stage ${{ (github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number)) || 'prod' }} diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index 5658d377..6c67f1a4 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -18,10 +18,10 @@ jobs: steps: - name: Check Out Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' From 613d6bc286e49af3f98b2727d2bbd345d579f812 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Wed, 7 Feb 2024 01:04:15 -0800 Subject: [PATCH 2/9] Adjust concurrency group names --- .github/workflows/build-and-deploy.yml | 2 +- .github/workflows/clean-up-pr.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index d45204b7..0aa1f2ad 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -18,7 +18,7 @@ jobs: url: https://${{ (github.event_name == 'pull_request' && format('staging-{0}.peterportal.org', github.event.pull_request.number)) || 'peterportal.org' }} concurrency: - group: build-${{ github.head_ref || github.run_id }} + group: build-and-deploy-${{ github.head_ref || github.run_id }} cancel-in-progress: true steps: diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index 6c67f1a4..8c0c498f 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -7,7 +7,7 @@ on: - master concurrency: - group: deploy-${{ github.head_ref || github.run_id }} + group: clean-up-pr-${{ github.head_ref || github.run_id }} jobs: clean-up-pr: From 62682c5ab749ccb3dde72b410dc3925e85a0f3e2 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Wed, 7 Feb 2024 01:07:27 -0800 Subject: [PATCH 3/9] Disable husky install in other workflows --- .github/workflows/clean-up-pr.yml | 2 ++ .github/workflows/lint.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index 8c0c498f..82b6bed7 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -28,6 +28,8 @@ jobs: - name: Install Dependencies run: npm install + env: + HUSKY: 0 - name: Remove staging stack run: npx sst remove --stage ${{ format('staging-{0}', github.event.pull_request.number) }} backend && npx sst remove --stage ${{ format('staging-{0}', github.event.pull_request.number) }} frontend diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index aef8fe65..b2790f25 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,6 +26,8 @@ jobs: - name: Install Dependencies run: npm install + env: + HUSKY: 0 - name: Lint run: npm run lint From ebf89a23c2e422ce86aebf0ab57cd61b502f757d Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Wed, 7 Feb 2024 01:07:57 -0800 Subject: [PATCH 4/9] Bump lint workflow action step versions --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b2790f25..24a5b211 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,10 +16,10 @@ jobs: steps: - name: Check Out Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' From d802d4744fbd5f902d23b48b1b6bde3ce22370fe Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Mon, 12 Feb 2024 22:14:15 -0800 Subject: [PATCH 5/9] Add remove deployment step --- .github/workflows/clean-up-pr.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index 82b6bed7..96687220 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -46,3 +46,10 @@ jobs: PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Remove deployment + uses: strumwolf/delete-deployment-environment@v3.0.0 + with: + environment: ${{ format('staging-{0}', github.event.pull_request.number) }} + token: ${{ secrets.GITHUB_TOKEN }} + onlyRemoveDeployments: true From d337a704d70273e9f810fece28e172f56f418811 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Tue, 13 Feb 2024 18:42:49 -0800 Subject: [PATCH 6/9] test --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 00000000..9daeafb9 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test From 0542d153ecdc7b9e5863539cbca5081a08a587f5 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Tue, 13 Feb 2024 19:32:28 -0800 Subject: [PATCH 7/9] Only deactivate deployments --- .github/workflows/clean-up-pr.yml | 4 ++-- test.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 test.txt diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index 96687220..60038cf2 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -47,9 +47,9 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - name: Remove deployment + - name: Deactivate deployment uses: strumwolf/delete-deployment-environment@v3.0.0 with: environment: ${{ format('staging-{0}', github.event.pull_request.number) }} token: ${{ secrets.GITHUB_TOKEN }} - onlyRemoveDeployments: true + onlyDeactivateDeployments: true diff --git a/test.txt b/test.txt deleted file mode 100644 index 9daeafb9..00000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -test From 7a80177bfb68fa9683c86e78cf3f5d61efd84e63 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Tue, 13 Feb 2024 19:35:08 -0800 Subject: [PATCH 8/9] Delete staging URL comment --- .github/workflows/clean-up-pr.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index 60038cf2..c985abb5 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -53,3 +53,9 @@ jobs: environment: ${{ format('staging-{0}', github.event.pull_request.number) }} token: ${{ secrets.GITHUB_TOKEN }} onlyDeactivateDeployments: true + + - name: Delete staging URL comment + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: staging url + delete: true From 0edfbc8cf62a0d9403e8b533fa4c5d7893030649 Mon Sep 17 00:00:00 2001 From: Jacob Sommer Date: Tue, 13 Feb 2024 22:31:15 -0800 Subject: [PATCH 9/9] Remove sticky comments --- .github/workflows/build-and-deploy.yml | 8 -------- .github/workflows/clean-up-pr.yml | 6 ------ 2 files changed, 14 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 0aa1f2ad..94dd50c7 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -52,11 +52,3 @@ jobs: 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' }} - - - name: Comment staging URL - uses: marocchino/sticky-pull-request-comment@v2 - if: ${{ github.event_name == 'pull_request' }} - with: - header: staging url - recreate: true - message: Deployed staging instance to https://staging-${{ github.event.pull_request.number }}.peterportal.org diff --git a/.github/workflows/clean-up-pr.yml b/.github/workflows/clean-up-pr.yml index c985abb5..60038cf2 100644 --- a/.github/workflows/clean-up-pr.yml +++ b/.github/workflows/clean-up-pr.yml @@ -53,9 +53,3 @@ jobs: environment: ${{ format('staging-{0}', github.event.pull_request.number) }} token: ${{ secrets.GITHUB_TOKEN }} onlyDeactivateDeployments: true - - - name: Delete staging URL comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: staging url - delete: true