Skip to content

fix: fix documentation build (#781) #597

fix: fix documentation build (#781)

fix: fix documentation build (#781) #597

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}}
- 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: 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