mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-06 14:45:06 +08:00
b6935673d5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
name: Build documentation
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
description: 'commit to build'
|
|
type: string
|
|
required: false
|
|
path:
|
|
description: 'path within the docs pages to build to'
|
|
type: string
|
|
required: false
|
|
artifact:
|
|
description: 'artifact name to write'
|
|
type: string
|
|
required: false
|
|
|
|
jobs:
|
|
build-docs:
|
|
name: Build documentation
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
- uses: actions/checkout@v3 # check out this repo
|
|
if: ${{ !inputs.ref }}
|
|
- uses: actions/checkout@v3 # check out the repo we're building docs for
|
|
if: ${{ inputs.ref }}
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
repository: bdunderscore/modular-avatar-images
|
|
path: modular-avatar-images
|
|
- name: Install logo assets
|
|
run: |
|
|
cp -Rv modular-avatar-images/img/* docs/static/img
|
|
|
|
- name: Setup yarn 2.0
|
|
run: |
|
|
corepack enable
|
|
corepack prepare yarn@stable --activate
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "dir=$(cd docs; yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v3
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Set baseUri
|
|
if: ${{ inputs.path }}
|
|
run: |
|
|
BASEURL="/${{ inputs.path }}/" perl -i -p -e "s{baseUrl: '/'}{baseUrl: '\$ENV{BASEURL}'}" docs/docusaurus.config.js
|
|
cat docs/docusaurus.config.js
|
|
|
|
- name: Build docs
|
|
run: |
|
|
cd docs
|
|
yarn install --immutable
|
|
yarn build
|
|
ls -lR build
|
|
|
|
- name: Set robots.txt
|
|
run: |
|
|
if [ -e docs/robots.txt ]; then
|
|
cp docs/robots.txt docs/build/robots.txt
|
|
fi
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.artifact || 'docs' }}
|
|
path: docs/build |