Skip to content

v0.8.4

v0.8.4 #20

Workflow file for this run

name: Release
on:
release:
types: [published]
workflow_call:
secrets:
NPM_TOKEN:
description: 'An access token for npm, used to publish the package'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- name: Update old documentation
run: |
cd gh-pages;
shopt -s nullglob;
for file in */*.html; do
base=${file##*/};
# replace any existing version warnings with the marker (that is also in layout.tmpl)
sed -i 's|<p class="version-warning"><strong>Warning:</strong> This is an old version. The latest stable version is <a href="../[^"]*">[^<]*</a>.</p>|<!-- VERSION-WARNING -->|' -- "$file";
# replace the marker (whether from layout.tmpl or from the previous command) with current version warning
sed -i 's|<!-- VERSION-WARNING -->|<p class="version-warning"><strong>Warning:</strong> This is an old version. The latest stable version is <a href="../${{ github.ref_name }}/'"$base"'">${{ github.ref_name }}</a>.</p>|' -- "$file";
done;
# update redirect to latest version
sed -i '/http-equiv/ s|^.*$|<meta http-equiv="refresh" content="0; URL=${{ github.ref_name }}/">|' index.html;
- name: Build new documentation
run: npm run doc
- name: Publish documentation changes
run: |
mv doc "gh-pages/${{ github.ref_name }}";
cd gh-pages;
git config user.name github-actions;
git config user.email github-actions@github.com;
git add .;
git commit -m "Publish docs for ${{ github.ref_name }}";
git push;