-
Notifications
You must be signed in to change notification settings - Fork 26
167 lines (144 loc) · 5.29 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
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.JS_COMPUTE_RUNTIME_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.JS_COMPUTE_RUNTIME_GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --mode=update-lockfile
working-directory: ./documentation
- run: npm run docusaurus docs:version "$(npm pkg get version --json --prefix=../ | jq -r)"
working-directory: ./documentation
- run: yarn install --mode=update-lockfile
working-directory: ./documentation/app
- run: npm run build:files
working-directory: ./documentation/app
- 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
publish:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.releases_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
- uses: ./.github/actions/cache-crates
with:
lockfiles: "runtime/js-compute-runtime/**/Cargo.lock"
- uses: ./.github/actions/install-rust
with:
path: runtime
- 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: "Check wasm-tools has been restored"
if: steps.wasm-tools.outputs.cache-hit != 'true'
run: |
echo "wasm-tools was not restored from the cache"
echo "bailing out from the build early"
exit 1
- name: Cache SpiderMonkey object files
uses: actions/cache@v2
id: sm-cache
with:
path: |
runtime/spidermonkey/release
key: cache-${{ hashFiles(
'runtime/spidermonkey/build-engine.sh',
'runtime/spidermonkey/gecko-revision',
'runtime/spidermonkey/object-files.list',
'runtime/rust-toolchain.toml'
) }}-release
- name: "Build SpiderMonkey"
if: ${{ steps.sm-cache.outputs.cache-hit != 'true' }}
run: |
cd runtime/spidermonkey/
bash ./build-engine.sh release
- name: "Install wasi-sdk-20 (linux)"
run: |
set -x
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
- name: "Install Binaryen (linux)"
run: |
set -x
export BINARYEN_VERSION=105
curl -sS -L "https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz" | tar xzf - &&
echo "$PWD/binaryen-version_${BINARYEN_VERSION}/bin" >> $GITHUB_PATH
- name: Cache built Rust dependencies
uses: actions/cache@v3
with:
path: runtime/js-compute-runtime/rusturl
key: engine-cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('runtime/rust-toolchain.toml', 'runtime/js-compute-runtime/**/Cargo.lock') }}
# We trust cargo to only reuse valid parts of the cache when dependencies change.
restore-keys: engine-cargo-${{ runner.os }}-${{ runner.arch }}-
- run: yarn install --immutable
- run: yarn build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- run: yarn
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: yarn deploy
timeout-minutes: 120
env:
FASTLY_API_TOKEN: ${{secrets.FASTLY_API_TOKEN}}
working-directory: ./documentation