Skip to content

Commit 30de37f

Browse files
committed
Update gh workflows
1 parent fe79200 commit 30de37f

File tree

4 files changed

+67
-48
lines changed

4 files changed

+67
-48
lines changed

.github/_workflow-samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This workflow gets triggered with every push to the main branch, and doesn't ver
1212
```
1313
- create an IAM with a policy that provides it with programmatic access to the bucket
1414
- add the AWS Access Key and Secret from the IAM [as encrypted secrets to the project repository](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository). Use `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY`
15-
- add the bucket name as an evironemnt variable (`DEPLOY_BUCKET`) to the deploy workflow. Omit `s3://` from the bucket name.
15+
- add the bucket name as an environment variable (`DEPLOY_BUCKET`) to the deploy workflow. Omit `s3://` from the bucket name.
1616

1717
## Serving site from sub-path
1818
This workflow assumes that the site is served from the root of the URL (eg. devseed.com). To support a URL served from a sub-path (eg. devseed.com/explorer), add the following step:

.github/_workflow-samples/deploy-gh.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,34 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v4
2525

26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
28+
2629
- name: Use Node.js
27-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
2831
with:
2932
node-version-file: '.nvmrc'
33+
cache: 'pnpm'
3034

3135
- name: Cache node_modules
32-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3337
id: cache-node-modules
3438
with:
3539
path: node_modules
3640
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
3741

3842
- name: Cache dist
39-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4044
id: cache-dist
4145
with:
4246
path: dist
4347
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
4448

4549
- name: Install
46-
run: npm install
50+
run: pnpm install
4751

4852
- name: Build
49-
run: npm run all:build
53+
run: pnpm build
5054

5155
deploy:
5256
runs-on: ubuntu-latest
@@ -57,7 +61,7 @@ jobs:
5761
uses: actions/checkout@v4
5862

5963
- name: Restore dist cache
60-
uses: actions/cache@v3
64+
uses: actions/cache@v4
6165
id: cache-dist
6266
with:
6367
path: dist

.github/_workflow-samples/deploy-s3.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,75 @@ on:
88
branches:
99
- 'main'
1010

11-
env:
12-
NODE: 18
13-
DEPLOY_BUCKET:
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
1414

1515
jobs:
1616
build:
1717
runs-on: ubuntu-latest
18+
env:
19+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
20+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1821

1922
steps:
20-
- name: Cancel Previous Runs
21-
uses: styfle/[email protected]
22-
with:
23-
access_token: ${{ github.token }}
24-
2523
- name: Checkout
26-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
2728

2829
- name: Use Node.js ${{ env.NODE }}
29-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
3031
with:
31-
node-version: ${{ env.NODE }}
32+
node-version-file: '.nvmrc'
33+
cache: 'pnpm'
3234

3335
- name: Cache node_modules
34-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3537
id: cache-node-modules
3638
with:
3739
path: node_modules
3840
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
3941

4042
- name: Cache dist
41-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4244
id: cache-dist
4345
with:
4446
path: dist
4547
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
4648

4749
- name: Install
48-
run: yarn install
50+
run: pnpm install
4951

5052
- name: Build
51-
run: yarn build
53+
run: pnpm build
5254

5355
deploy:
5456
runs-on: ubuntu-latest
5557
needs: build
5658

5759
steps:
5860
- name: Checkout
59-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
6062

6163
- name: Restore dist cache
62-
uses: actions/cache@v3
64+
uses: actions/cache@v4
6365
id: cache-dist
6466
with:
6567
path: dist
6668
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
6769

70+
# Action: https://github.com/marketplace/actions/s3-deploy
6871
- name: Deploy to S3
69-
uses: jakejarvis/s3-sync-action@master
72+
uses: reggionick/s3-deploy@v4
7073
with:
71-
args: --acl public-read --follow-symlinks --delete
72-
env:
73-
AWS_S3_BUCKET: ${{ env.DEPLOY_BUCKET }}
74-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
75-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
76-
SOURCE_DIR: ./dist
74+
folder: dist
75+
bucket: ${{ secrets.S3_BUCKET }}
76+
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
77+
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
78+
invalidation: /
79+
delete-removed: true
80+
no-cache: true
81+
private: true
82+
files-to-include: '{.*/**,**}'

.github/workflows/checks.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ on:
1717
- reopened
1818
- ready_for_review
1919

20-
env:
21-
NODE: 20
22-
2320
concurrency:
2421
group: ${{ github.workflow }}-${{ github.ref }}
2522
cancel-in-progress: true
@@ -33,20 +30,24 @@ jobs:
3330
- name: Checkout
3431
uses: actions/checkout@v4
3532

33+
- name: Install pnpm
34+
uses: pnpm/action-setup@v4
35+
3636
- name: Use Node.js ${{ env.NODE }}
37-
uses: actions/setup-node@v3
37+
uses: actions/setup-node@v4
3838
with:
39-
node-version: ${{ env.NODE }}
39+
node-version-file: '.nvmrc'
40+
cache: 'pnpm'
4041

4142
- name: Cache node_modules
42-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4344
id: cache-node-modules
4445
with:
4546
path: node_modules
4647
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
4748

4849
- name: Install
49-
run: npm install
50+
run: pnpm install
5051

5152
lint:
5253
needs: prep
@@ -56,23 +57,27 @@ jobs:
5657
- name: Checkout
5758
uses: actions/checkout@v4
5859

60+
- name: Install pnpm
61+
uses: pnpm/action-setup@v4
62+
5963
- name: Use Node.js ${{ env.NODE }}
60-
uses: actions/setup-node@v3
64+
uses: actions/setup-node@v4
6165
with:
62-
node-version: ${{ env.NODE }}
66+
node-version-file: '.nvmrc'
67+
cache: 'pnpm'
6368

6469
- name: Cache node_modules
65-
uses: actions/cache@v3
70+
uses: actions/cache@v4
6671
id: cache-node-modules
6772
with:
6873
path: node_modules
6974
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
7075

7176
- name: Install
72-
run: npm install
77+
run: pnpm install
7378

7479
- name: Lint
75-
run: npm run lint
80+
run: pnpm lint
7681

7782
test:
7883
needs: prep
@@ -82,20 +87,24 @@ jobs:
8287
- name: Checkout
8388
uses: actions/checkout@v4
8489

90+
- name: Install pnpm
91+
uses: pnpm/action-setup@v4
92+
8593
- name: Use Node.js ${{ env.NODE }}
86-
uses: actions/setup-node@v3
94+
uses: actions/setup-node@v4
8795
with:
88-
node-version: ${{ env.NODE }}
96+
node-version-file: '.nvmrc'
97+
cache: 'pnpm'
8998

9099
- name: Cache node_modules
91-
uses: actions/cache@v3
100+
uses: actions/cache@v4
92101
id: cache-node-modules
93102
with:
94103
path: node_modules
95104
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
96105

97106
- name: Install
98-
run: npm install
107+
run: pnpm install
99108

100109
- name: Test
101-
run: npm run test
110+
run: pnpm run test

0 commit comments

Comments
 (0)