Skip to content

yomotsu:main←abernier:main #97

yomotsu:main←abernier:main

yomotsu:main←abernier:main #97

Workflow file for this run

name: Build and Release to npm
on:
push:
branches:
- "main"
- "canary-*"
pull_request:
# Cancel any previous run (see: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release-job:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies and Release
id: main
run: |
npm ci
npm run release
# Check if release was successful (dist directory exists)
if [ ! -d "dist/" ]; then
echo "Release did not create dist directory, running build..."
npm run build
fi
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate documentation
run: npm run typedoc
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: typedoc-docs
path: docs/
deploy-job:
needs: release-job
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Download typedoc docs artifact
uses: actions/download-artifact@v4
with:
name: typedoc-docs
path: docs/
- name: Prepare examples directory
run: |
# Remove the alias to dist (if it exists)
find examples -name "* alias" -delete
find examples -name "dist" -type l -delete
rm -rf examples/dist
# Copy the actual dist content to examples/dist
cp -r dist examples/dist
- name: Prepare docs directory
run: |
# Copy examples to docs directory
cp -r examples docs/
# Delete any remaining symbolic links and macOS aliases under the docs directory
find docs -type l -delete
find docs -name "* alias" -delete
find docs -type l -delete
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ./docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4