Publish documentation #28
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 Docs | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: The tag to build Docs for | |
required: false | |
jobs: | |
publish-docs: | |
runs-on: ubuntu-latest | |
if: ${{ inputs.tag != '' }} | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.tag }} | |
- name: Create new branch | |
run: | | |
git checkout -b new-docs-version-${{ github.event.inputs.tag }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: Install Yarn dependencies | |
run: yarn | |
- name: Cut a new version | |
working-directory: ./docs | |
run: yarn docusaurus docs:version ${{ inputs.tag }} | |
- name: Remove pre-releases | |
id: get_version | |
run: | | |
cd docs && yarn setStable | |
- name: Commit new documentation version | |
run: | | |
git config --local user.name 'signorecello' | |
git config --local user.email '[email protected]' | |
git add . | |
git commit -m "chore(docs): cut new docs version for tag ${{ github.event.inputs.tag }}" | |
- name: Push changes to new branch | |
run: git push origin new-docs-version-${{ github.event.inputs.tag }} | |
- name: Create Pull Request | |
run: | | |
gh pr create \ | |
--title "chore(docs): docs for ${{ github.event.inputs.tag }}" \ | |
--body "Updates documentation to new version for tag ${{ github.event.inputs.tag }}." \ | |
--base master \ | |
--head new-docs-version-${{ github.event.inputs.tag }} \ | |
--label documentation | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docs | |
run: yarn workspace docs build | |
- name: Deploy to Netlify | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: './docs/build' | |
production-branch: master | |
production-deploy: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
enable-github-deployment: false | |
deploy-message: "Deploy from GitHub Actions for tag ${{ inputs.tag }}" | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 1 | |