-
Notifications
You must be signed in to change notification settings - Fork 17
178 lines (147 loc) · 5.65 KB
/
push.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Build
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
env:
NODE_OPTIONS: "--max-old-space-size=8192"
steps:
- uses: linz/action-typescript@v3
build-deploy:
runs-on: ubuntu-latest
concurrency: deploy-${{ github.ref }}
permissions:
id-token: write
contents: write
steps:
- uses: linz/action-typescript@v3
# TODO: running a giant copy command to import CSS and SVG files into the docs file in not super ideal
- name: Build docs
run: |
cp node_modules/@linzjs/lui/dist/assets/images/linz-motif.svg docs/
docker run --rm -v ${PWD}:/docs ghcr.io/linz/basemaps-mkdocs:v1 build
- name: Store docs artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: packages/landing/dist/docs
# pulls all tags (needed for lerna to correctly version)
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # see https://stackoverflow.com/a/60184319/9285308
- name: Check Dependencies
run: node scripts/detect.unlinked.dep.mjs
- name: (Prod) Create tag
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
CURRENT_VERSION=$(node -p "require('./lerna.json').version")
git tag v${CURRENT_VERSION} -m v${CURRENT_VERSION}
git push --tags
- name: (Prod) Create github release
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')
run: npx conventional-github-releaser -p angular
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: (Prod) Publish NPM
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')
run: npx lerna publish from-git --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN_LINZJS}}
- name: Benchmark
uses: blacha/hyperfine-action@v1
deploy-dev:
runs-on: ubuntu-latest
concurrency: deploy-dev-${{ github.ref }}
needs: [build-deploy]
if: github.ref == 'refs/heads/master' && github.repository == 'linz/basemaps'
environment:
name: nonprod
url: https://dev.basemaps.linz.govt.nz
permissions:
id-token: write
contents: write
steps:
- uses: linz/action-typescript@v3
- name: Build docs
run: |
# dist folder must exist or it will be owned by root
mkdir -p packages/landing/dist
cp node_modules/@linzjs/lui/dist/assets/images/linz-motif.svg docs/
docker run \
--rm \
-v ${PWD}:/docs \
-e GOOGLE_ANALYTICS \
-e BASEMAPS_DOCS_URL \
ghcr.io/linz/basemaps-mkdocs:v1 build
env:
GOOGLE_ANALYTICS: ${{ secrets.GOOGLE_ANALYTICS }}
BASEMAPS_DOCS_URL: https://dev.basemaps.linz.govt.nz/docs/
# pulls all tags (needed for lerna to correctly version)
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # see https://stackoverflow.com/a/60184319/9285308
- name: (Dev) Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
- name: (Dev) Deploy
run: |
npx lerna run bundle --stream
npx lerna run deploy:deploy --stream
env:
GOOGLE_ANALYTICS: ${{ secrets.GOOGLE_ANALYTICS }}
NODE_ENV: 'dev'
- name: (Dev) After Deploy Smoke Test
run: |
cd packages/smoke
node --test
deploy-prod:
runs-on: ubuntu-latest
concurrency: deploy-prod-${{ github.ref }}
needs: [deploy-dev]
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')
environment:
name: prod
url: https://basemaps.linz.govt.nz
permissions:
id-token: write
contents: write
steps:
- uses: linz/action-typescript@v3
- name: Build docs
run: |
# dist folder must exist or it will be owned by root
mkdir -p packages/landing/dist
cp node_modules/@linzjs/lui/dist/assets/images/linz-motif.svg docs/
docker run \
--rm \
-v ${PWD}:/docs \
-e GOOGLE_ANALYTICS \
-e BASEMAPS_DOCS_URL \
ghcr.io/linz/basemaps-mkdocs:v1 build
env:
GOOGLE_ANALYTICS: ${{ secrets.GOOGLE_ANALYTICS }}
BASEMAPS_DOCS_URL: https://basemaps.linz.govt.nz/docs/
# pulls all tags (needed for lerna to correctly version)
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # see https://stackoverflow.com/a/60184319/9285308
- name: (Prod) Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
- name: (Prod) Deploy
run: |
npx lerna run bundle --stream
npx lerna run deploy:deploy --stream
env:
NODE_ENV: 'production'
GOOGLE_ANALYTICS: ${{ secrets.GOOGLE_ANALYTICS }}
- name: (Prod) After Deploy Smoke Test
run: |
cd packages/smoke
BASEMAPS_HOST=https://basemaps.linz.govt.nz node --test