-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (136 loc) · 5.34 KB
/
master.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: master
on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [ opened, reopened, synchronize ]
permissions:
actions: read
contents: read
pages: write
id-token: write
jobs:
setup:
continue-on-error: true
timeout-minutes: 5
runs-on: ubuntu-22.04
outputs:
yarn-cache-config: ${{ steps.setup-yarn-cache.outputs.config }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: setup-yarn-cache
run: ./scripts/github-setup-cache.sh
--cache-key ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
--restore-key ${{ runner.os }}-yarn-
| tee $GITHUB_OUTPUT
lint:
needs: [ setup ]
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with: { node-version: '22' }
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with: ${{ fromJson(needs.setup.outputs.yarn-cache-config) }}
- run: yarn install --immutable
- run: yarn lint
test:
needs: [ setup ]
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with: { node-version: '22' }
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with: ${{ fromJson(needs.setup.outputs.yarn-cache-config) }}
- run: yarn install --immutable
- run: yarn test
build-dev:
needs: [ setup ]
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with: { node-version: '22' }
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with: ${{ fromJson(needs.setup.outputs.yarn-cache-config) }}
- run: yarn install --immutable
- run: yarn build --mode dev
- run: tar --directory dist -cvf centrapay-docs-dev.tar .
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: centrapay-docs-dev
path: centrapay-docs-dev.tar
build-prod:
needs: [ setup ]
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with: { node-version: '22' }
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with: ${{ fromJson(needs.setup.outputs.yarn-cache-config) }}
- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- run: yarn install --immutable
- run: yarn build --mode prod
- run: tar --directory dist -cvf centrapay-docs-prod.tar .
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: centrapay-docs-prod
path: centrapay-docs-prod.tar
integration:
needs: [ setup, build-prod ]
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with: { node-version: '22' }
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with: ${{ fromJson(needs.setup.outputs.yarn-cache-config) }}
- run: yarn install --immutable
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: centrapay-docs-prod
- run: mkdir -p dist && tar --directory dist -xvf centrapay-docs-prod.tar
- run: yarn linkinator
- run: yarn integration
deploy-dev:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev-preview'
needs: [ setup, lint, test, build-dev, build-prod, integration ]
timeout-minutes: 5
runs-on: ubuntu-22.04
environment:
name: dev
url: http://centrapay-docs.dev.s3-website-ap-southeast-1.amazonaws.com
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: centrapay-docs-dev
- run: mkdir -p dist && tar --directory dist -xvf centrapay-docs-dev.tar
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: arn:aws:iam::450412180052:role/github-actions-centrapay-docs
role-session-name: centrapay-docs-deploy-dev-session
aws-region: ap-southeast-1
- run: aws s3 cp dist s3://centrapay-docs.dev/ --recursive
deploy-prod:
if: github.ref == 'refs/heads/master'
needs: [ deploy-dev ]
timeout-minutes: 5
runs-on: ubuntu-22.04
environment:
name: prod
url: ${{steps.deployment.outputs.page_url}}
steps:
- id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
with:
artifact_name: centrapay-docs-prod