Skip to content

Deploy Pages

Deploy Pages #286

Workflow file for this run

name: Deploy Pages
on:
workflow_dispatch:
workflow_run:
workflows: [Build]
types:
- completed
branches: [master, latest-docs]
release:
types: [published, unpublished]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
env:
listPublishDirectory: Website
pathToCi: ci
jobs:
build-repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Wait for Latest Release
run: sleep 10
- name: Build Package Version Listing
run: |
npm install --no-save got@12.5.3
node scripts/create_index_json.mjs kurotu/VRCQuestTools Packages/com.github.kurotu.vrc-quest-tools/package.json > index.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: repo
path: index.json
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: latest-docs
- uses: actions/checkout@v4
with:
ref: master
path: current
- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: Website/package-lock.json
- run: cd Website && npm ci
- name: Generate changelog
run: |
./scripts/generate-changelog-links.sh | cat CHANGELOG.md - > Website/docs/changelog.md
./scripts/generate-changelog-links.sh | cat CHANGELOG_JP.md - > Website/i18n/ja/docusaurus-plugin-content-docs/current/changelog.md
- name: Make versioned docs
run: cd Website && npm run docusaurus docs:version $(jq -r .version ../Packages/com.github.kurotu.vrc-quest-tools/package.json)
- name: Copy i18n file
run: |
VERSION=$(jq -r .version Packages/com.github.kurotu.vrc-quest-tools/package.json)
cd Website/i18n/ja/docusaurus-plugin-content-docs
jq --arg version $VERSION '."version.label".message = $version' current.json > version-${VERSION}.json
- name: Copy current docs
run: |
rm -r Website/docs
cp -r current/Website/docs Website/
rm -r Website/i18n/ja/docusaurus-plugin-content-docs/current
cp -r current/Website/i18n/ja/docusaurus-plugin-content-docs/current Website/i18n/ja/docusaurus-plugin-content-docs/
- name: Generate current changelog
run: |
./scripts/generate-changelog-links.sh | cat current/CHANGELOG.md - > Website/docs/changelog.md
./scripts/generate-changelog-links.sh | cat current/CHANGELOG_JP.md - > Website/i18n/ja/docusaurus-plugin-content-docs/current/changelog.md
- run: cd Website && npm run build
- uses: actions/upload-artifact@v4
with:
name: docs
path: Website/build
deploy:
needs: [build-repo, build-docs]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: repo
path: ${{env.listPublishDirectory}}
- uses: actions/download-artifact@v4
with:
name: docs
path: ${{env.listPublishDirectory}}
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{env.listPublishDirectory}}
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1