Jasper Vaneessen 2d884c7252
ci: split up into multiple workflows
* ci: split up workflows

* ci: tweaks and housekeeping

* ci: additional comments and requested changes

* ci: additional comments

* chore: clean up .gitignore
2022-09-05 13:11:20 +02:00

58 lines
1.8 KiB
YAML

name: Documentation
on:
workflow_call:
# Additional trigger to deploy changes to the documentation/ folder
# on push to main, ignoring tags so we don't trigger twice upon release
push:
branches:
- main
paths:
- documentation/**
tags-ignore:
- "*"
jobs:
mkdocs-prep:
# Runs the markdownlinter to ensure we don't release faulty markdown.
# Also gets the correct major version, wether the job is triggered by a version tag
# or a push to main to update the latest documentation.
runs-on: ubuntu-latest
outputs:
major: ${{ steps.tagged_version.outputs.major || steps.current_version.ouputs.major }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- run: npm ci --ignore-scripts
- name: Lint documentation markdown
run: npm run lint:markdown -- documentation/**/*.md
- if: startsWith(github.ref, 'refs/tags/v')
name: Get tagged version
id: tagged_version
uses: battila7/get-version-action@v2
- if: github.ref == 'refs/heads/main'
name: Get current version
id: current_version
run: |
VERSION=$(git show origin/main:package.json | jq -r .version | grep -Po '^(\d+)')
echo "::set-output name=major::$VERSION"
mkdocs:
runs-on: ubuntu-latest
needs: mkdocs-prep
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: pip install mkdocs-material
- run: pip install mike
- run: git config user.name ci-bot
- run: git config user.email ci-bot@example.com
- run: git fetch origin gh-pages --depth=1
- run: |
cd documentation && mike deploy --push --update-aliases \
${{ needs.mkdocs-prep.outputs.major}}.x latest