Skip to content

8.7.0

8.7.0 #313

Workflow file for this run

name: Update docs
on:
push:
tags:
- "v7.*.*" # all v7 semver release tags
- "v8.*.*" # all v8 semver release tags
branches:
- stable
jobs:
publish-docs:
runs-on: ubuntu-latest
container:
image: node:16
steps:
- name: Checkout current commit
uses: actions/checkout@v2
- name: Checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- run: apt-get update && apt-get install jq -y
- run: npm install -g npm@7
- run: npm install
- name: Set TAG env to devel
if: startsWith( github.event.ref, 'refs/heads/' )
run: |
echo "TAG=devel" >> $GITHUB_ENV
echo "LATEST=1" >> $GITHUB_ENV
- name: Set TAG env to ref tag
if: startsWith( github.event.ref, 'refs/tags/v' )
run: |
export TAG=$(echo ${{ github.event.ref }} | sed -e 's/^refs\/tags\/v//')
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "LATEST=$(node -p "Number(require('semver').gt('${TAG}','$(cat gh-pages/VERSION)'))")" >> $GITHUB_ENV
- name: Update VERSION / latest
if: env.TAG != 'devel' && env.LATEST == 1
run: |
echo $'---\npermalink: /VERSION\ntitle: "VERSION"\n---\n' > gh-pages/VERSION.md
echo $TAG >> gh-pages/VERSION
ln -s $TAG gh-pages/latest
- name: Update CHANGELOG
if: env.LATEST == 1 # don't overwrite for backport versions
run: |
echo $'---\npermalink: /CHANGELOG\ntitle: "CHANGELOG"\n---\n' > gh-pages/CHANGELOG.md
cat CHANGELOG.md >> gh-pages/CHANGELOG.md
- name: Update MIGRATING
if: env.LATEST == 1 # don't overwrite for backport versions
run: |
echo $'---\npermalink: /MIGRATING\ntitle: "Migrating"\n---\n' > gh-pages/MIGRATING.md
cat MIGRATING.md >> gh-pages/MIGRATING.md
- name: Remove old docs
run: |
rm -rf gh-pages/${TAG}
- name: Rebuild docs for tag
if: env.TAG != 'devel'
run: |
./node_modules/.bin/typedoc --includeVersion --gitRevision ${TAG} --out gh-pages/${TAG}
node -p 'var all=fs.readdirSync("gh-pages",{withFileTypes:true}).flatMap(f=>f.isDirectory()&&!isNaN(f.name.charAt(0))?[f.name]:[]).sort(require("semver").rcompare);JSON.stringify({all,stable:all.filter(s=>!s.includes("-"))})' > gh-pages/_data/versions.json
- name: Rebuild docs for devel
if: env.TAG == 'devel'
run: |
./node_modules/.bin/typedoc --out gh-pages/${TAG}
- name: Commit to gh-pages
uses: EndBug/add-and-commit@v4
with:
cwd: ./gh-pages
ref: gh-pages
message: Update ${{ env.TAG }} docs via ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}