v0.2.0-next.1 #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
release: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
packages: write | |
pages: write | |
steps: | |
# Set up | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
registry-url: "https://registry.npmjs.org" | |
# Prepare for release | |
- name: Install dependencies | |
run: | | |
yarn install --immutable | |
- name: Build | |
run: | | |
yarn build | |
- name: Run tests | |
run: | | |
yarn test | |
- id: dist-tag | |
name: Define dist tag | |
run: | | |
if ${{ github.event.release.prerelease }}; then | |
DIST_TAG=next | |
else | |
DIST_TAG=latest | |
fi | |
echo "dist-tag=$DIST_TAG" >> $GITHUB_OUTPUT | |
# Release to NPM | |
- name: Publish package on NPM | |
run: cd out && npm publish --provenance --access public --tag ${{ steps.dist-tag.outputs.dist-tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Release to GitHub Packages | |
- name: Setup Node for GitHub Packages | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
registry-url: "https://npm.pkg.github.com" | |
- name: Publish package on GitHub Packages | |
run: cd out && npm publish --access public --tag ${{ steps.dist-tag.outputs.dist-tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Publish website | |
- name: Prepare to build website | |
run: | | |
rustup set profile minimal | |
rustup component remove --toolchain=x86_64-unknown-linux-gnu rust-docs || echo "already removed" | |
rustup update --no-self-update x86_64-unknown-linux-gnu | |
cargo install mdbook | |
- name: Build website | |
env: | |
MDBOOK_OUTPUT__HTML__SITE_URL: /kdl/ | |
run: cd documentation && mdbook build | |
- name: Upload website | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: documentation/book | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |