Skip to content

Merge pull request #469 from akashic-games/dependabot/npm_and_yarn/ba… #67

Merge pull request #469 from akashic-games/dependabot/npm_and_yarn/ba…

Merge pull request #469 from akashic-games/dependabot/npm_and_yarn/ba… #67

Workflow file for this run

name: Deploy API Document on GitHub Pages
on:
workflow_dispatch:
push:
branches:
# 現状過去バージョンのブランチでは GitHub Actions が有効になっておらず、また過去バージョンを更新することは事実上ほとんどないという理由により、
# main ブランチへの push 契機ですべてのバージョンを更新するように意図している。
# 万が一過去バージョンのみの更新が発生した場合は workflow_dispatch を手動で実行すること。
- main
env:
NODE_VERSION: '18'
PUBLIC_DIR: public
V3_REF: main
V2_REF: v2-main
V1_REF: v1-main
V3_DIR: v3
V2_DIR: v2
V1_DIR: v1
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Setup Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Checkout (v3)
uses: actions/checkout@v4
with:
ref: ${{ env.V3_REF }}
path: ${{ env.V3_DIR }}
- name: Checkout (v2)
uses: actions/checkout@v4
with:
ref: ${{ env.V2_REF }}
path: ${{ env.V2_DIR }}
- name: Checkout (v1)
uses: actions/checkout@v4
with:
ref: ${{ env.V1_REF }}
path: ${{ env.V1_DIR }}
- name: Install and Build (v3)
working-directory: ${{ env.V3_DIR }}
run: |
npm ci
npm run doc
- name: Install and Build (v2)
working-directory: ${{ env.V2_DIR }}
run: |
npm ci
npm run doc
- name: Install and Build (v1)
working-directory: ${{ env.V1_DIR }}
run: |
npm install
npm run doc
- name: Copy API docs
run: |
mkdir -p ${{ env.PUBLIC_DIR }}
cp -r ${{ env.V3_DIR }}/doc/html/ ${{ env.PUBLIC_DIR }}/${{ env.V3_DIR }}/
cp -r ${{ env.V2_DIR }}/doc/html/ ${{ env.PUBLIC_DIR }}/${{ env.V2_DIR }}/
cp -r ${{ env.V1_DIR }}/doc/html/ ${{ env.PUBLIC_DIR }}/${{ env.V1_DIR }}/
- name: Check API docs
run: |
for dir in ${{ env.V1_DIR }} ${{ env.V2_DIR }} ${{ env.V3_DIR }}
do
if [ ! -e ${{ env.PUBLIC_DIR }}/${dir}/index.html ]; then
echo "'${{ env.PUBLIC_DIR }}/${dir}/index.html' not found."
exit 1;
fi
done
- name: Deploy on gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.PUBLIC_DIR }}
user_name: 'github-actions'
user_email: '41898282+github-actions[bot]@users.noreply.github.com'