Skip to content

Commit d11857c

Browse files
authored
Add no deploy label + misc actions stuff (#423)
* Added no deploy label * Updated actions versions to v4 * Disabled husky install on actions * Added environment for deployment * Remove sticky comments
1 parent 7499388 commit d11857c

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.github/workflows/build-and-deploy.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,29 @@ jobs:
1212
build_and_deploy:
1313
name: Build and deploy PeterPortal
1414
runs-on: ubuntu-latest
15+
if: (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'no deploy'))
16+
environment:
17+
name: ${{ (github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number)) || 'production' }}
18+
url: https://${{ (github.event_name == 'pull_request' && format('staging-{0}.peterportal.org', github.event.pull_request.number)) || 'peterportal.org' }}
1519

1620
concurrency:
17-
group: build-${{ github.head_ref || github.run_id }}
21+
group: build-and-deploy-${{ github.head_ref || github.run_id }}
1822
cancel-in-progress: true
1923

2024
steps:
2125
- name: Check Out Repo
22-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2327

2428
- name: Setup Node
25-
uses: actions/setup-node@v3
29+
uses: actions/setup-node@v4
2630
with:
2731
node-version: '18'
2832
cache: 'npm'
2933

3034
- name: Install Dependencies
3135
run: npm install
36+
env:
37+
HUSKY: 0
3238

3339
- name: Build and deploy
3440
run: npx sst deploy --stage ${{ (github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number)) || 'prod' }}
@@ -46,11 +52,3 @@ jobs:
4652
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
4753
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4854
NODE_ENV: ${{ github.event_name == 'pull_request' && 'staging' || 'production' }}
49-
50-
- name: Comment staging URL
51-
uses: marocchino/sticky-pull-request-comment@v2
52-
if: ${{ github.event_name == 'pull_request' }}
53-
with:
54-
header: staging url
55-
recreate: true
56-
message: Deployed staging instance to https://staging-${{ github.event.pull_request.number }}.peterportal.org

.github/workflows/clean-up-pr.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- master
88

99
concurrency:
10-
group: deploy-${{ github.head_ref || github.run_id }}
10+
group: clean-up-pr-${{ github.head_ref || github.run_id }}
1111

1212
jobs:
1313
clean-up-pr:
@@ -18,16 +18,18 @@ jobs:
1818

1919
steps:
2020
- name: Check Out Repo
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222

2323
- name: Setup Node
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: '18'
2727
cache: 'npm'
2828

2929
- name: Install Dependencies
3030
run: npm install
31+
env:
32+
HUSKY: 0
3133

3234
- name: Remove staging stack
3335
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
@@ -44,3 +46,10 @@ jobs:
4446
PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}}
4547
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
4648
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
49+
50+
- name: Deactivate deployment
51+
uses: strumwolf/[email protected]
52+
with:
53+
environment: ${{ format('staging-{0}', github.event.pull_request.number) }}
54+
token: ${{ secrets.GITHUB_TOKEN }}
55+
onlyDeactivateDeployments: true

.github/workflows/lint.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@ jobs:
1616

1717
steps:
1818
- name: Check Out Repo
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Setup Node
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
2424
node-version: '18'
2525
cache: 'npm'
2626

2727
- name: Install Dependencies
2828
run: npm install
29+
env:
30+
HUSKY: 0
2931

3032
- name: Lint
3133
run: npm run lint

0 commit comments

Comments
 (0)