Files
discordeno/.github/workflows/site.yml
2023-04-01 02:46:46 +02:00

96 lines
2.9 KiB
YAML

# This is a basic workflow to help you get started with Actions
name: Deploy Docs Site
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ['main']
paths:
- 'website/**'
- '.github/workflows/site.yml'
- 'jsdoc2md.json'
- 'typedoc.json'
- 'package.json'
- 'packages/**'
pull_request:
branches: ['main']
paths:
- 'website/**'
- '.github/workflows/site.yml'
- 'jsdoc2md.json'
- 'typedoc.json'
- 'package.json'
- 'packages/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
name: Build Docusaurus
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get yarn cache directory path (root)
id: yarn-cache-dir-path-root
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path-root.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install (root)
run: yarn install --immutable
- name: Build all pkg
run: yarn release-build
- name: Build docs
run: yarn build:doc
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
working-directory: ./website
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-site-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-site-
- run: yarn install --immutable
working-directory: ./website
- name: Build website
run: yarn build
working-directory: ./website
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./website/build
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1