-
Notifications
You must be signed in to change notification settings - Fork 28
182 lines (161 loc) · 5.2 KB
/
release-please.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
179
180
181
182
on:
push:
branches:
- main
env:
wasm-tools_version: 1.0.28
name: release-please
jobs:
release:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
pr: ${{ steps.release.outputs.pr }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: "@fastly/js-compute"
changelog-path: "CHANGELOG.md"
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
update-lock-and-docs:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.pr && !needs.release.outputs.releases_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
ref: release-please--branches--main--components--js-compute
fetch-depth: 2
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: npm update
working-directory: ./documentation
- run: npm run docusaurus docs:version "$(npm pkg get version --json --prefix=../ | jq -r)"
working-directory: ./documentation
- run: npm update
working-directory: ./documentation/app
- run: npm run build:files
working-directory: ./documentation/app
- run: npm install && npm run format-changelog
- name: Committing and push changes
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "chore: add docs for $(npm pkg get version --json | jq -r)"
git push --force
build:
name: Build
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.releases_created }}
strategy:
matrix:
profile: [debug, release, weval]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust 1.77.1
run: |
rustup toolchain install 1.77.1
rustup target add wasm32-wasi --toolchain 1.77.1
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- name: Build
if: ${{ matrix.profile == 'release' }}
run: npm run build
- name: Build
if: ${{ matrix.profile == 'debug' }}
run: npm run build:debug
- name: Build
if: ${{ matrix.profile == 'weval' }}
run: npm run build:weval
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: fastly-${{ matrix.profile }}
path: fastly${{ matrix.profile == 'debug' && '.debug.wasm' || (matrix.profile == 'weval' && '-weval.wasm' || '.wasm') }}
- uses: actions/upload-artifact@v3
if: ${{ matrix.profile == 'weval' }}
with:
name: fastly-${{ matrix.profile }}-ic-cache
path: fastly-ics.wevalcache
publish:
runs-on: ubuntu-latest
needs: [release, build]
if: ${{ needs.release.outputs.releases_created }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
with:
path: "/home/runner/.cargo/bin/wasm-tools"
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
- run: npm install --immutable
- name: Download Engine Release
uses: actions/download-artifact@v3
with:
name: fastly-release
- name: Download Engine Debug
uses: actions/download-artifact@v3
with:
name: fastly-debug
- name: Download Engine Weval
uses: actions/download-artifact@v3
with:
name: fastly-weval
- name: Download Engine Weval Cache
uses: actions/download-artifact@v3
with:
name: fastly-weval-ic-cache
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: github package registry publish
run: |
cat << EOF > .npmrc
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@fastly:registry=https://npm.pkg.github.com
registry=https://registry.npmjs.org/
always-auth=true
EOF
npm publish
rm .npmrc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm install
working-directory: ./documentation
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
cli_version: '7.0.1'
- run: npm run deploy
timeout-minutes: 120
env:
FASTLY_API_TOKEN: ${{secrets.FASTLY_API_TOKEN}}
working-directory: ./documentation