This commit is contained in:
bd_ 2023-10-11 18:39:20 +09:00
parent bbb9cb9ac9
commit 38500d0b54
2 changed files with 47 additions and 27 deletions

View File

@ -57,9 +57,9 @@ jobs:
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with: with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} key: ${{ runner.os }}-yarn-docs-${{ hashFiles('**/yarn.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-docs-
- name: Set baseUri - name: Set baseUri
if: ${{ inputs.path }} if: ${{ inputs.path }}

View File

@ -4,20 +4,16 @@ on:
branches: branches:
- main - main
- docs-snapshot - docs-snapshot
- docs-ci-test
workflow_dispatch: {} workflow_dispatch: {}
release: release:
types: types:
- released - released
permissions:
contents: read
pages: write
id-token: write
concurrency: concurrency:
group: "pages" group: "pages-cf"
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
snapshot-docs: snapshot-docs:
name: Snapshot documentation name: Snapshot documentation
@ -57,23 +53,30 @@ jobs:
ref: main ref: main
path: dev path: dev
artifact: docs-dev artifact: docs-dev
deploy-docs: deploy-docs:
name: Deploy documentation name: Deploy documentation
needs: needs:
- build-docs - build-docs
- build-docs-dev - build-docs-dev
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download artifact - uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Download artifact (tagged)
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: docs name: docs
path: docs/build path: docs/build
- name: Download artifact
- name: Download artifact (latest)
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: docs-dev name: docs-dev
@ -85,18 +88,35 @@ jobs:
- name: Unpack documentation - name: Unpack documentation
run: | run: |
tar -xf docs/build/docs.tar -C docs/build tar -xf docs/build/docs.tar -C docs-site~/public
tar -xf docs/build/dev/docs.tar -C docs/build/dev tar -xf docs/build/dev/docs.tar -C docs-site~/public/dev
rm -f docs/build/docs.tar docs/build/dev/docs.tar
- 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-site~; yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Setup Pages - uses: actions/cache@v3
uses: actions/configure-pages@v3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with: with:
path: docs/build path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-site-${{ hashFiles('**/yarn.lock') }}
- name: Deploy to GitHub Pages restore-keys: |
id: deployment ${{ runner.os }}-yarn-site-
uses: actions/deploy-pages@v2
- name: Build CF site
run: |
cd docs-site~
yarn install --immutable
yarn build
ls -lR build
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy --name modular-avatar-docs --old-asset-ttl 300