chore: update latest Yostar game data commit SHA #305
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy SSG to GitHub Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows running this workflow manually from the Actions tab | |
workflow_dispatch: | |
# 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: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout CN game data | |
uses: actions/checkout@v3 | |
with: | |
repository: Kengxxiao/ArknightsGameData | |
path: ArknightsGameData | |
- name: Checkout Yostar game data | |
uses: actions/checkout@v3 | |
with: | |
repository: Kengxxiao/ArknightsGameData_YoStar | |
path: ArknightsGameData_YoStar | |
- name: Set environment variables | |
run: | | |
echo "CN_GAME_DATA_ROOT_PATH=$(echo $GITHUB_WORKSPACE)/ArknightsGameData" >> $GITHUB_ENV | |
echo "YOSTAR_GAME_DATA_ROOT_PATH=$(echo $GITHUB_WORKSPACE)/ArknightsGameData_YoStar" >> $GITHUB_ENV | |
echo "ENABLE_SSR=true" >> $GITHUB_ENV | |
echo "NUXT_APP_BASE_URL=/$(echo ${GITHUB_REPOSITORY##*/})/" >> $GITHUB_ENV | |
echo "NUXT_PUBLIC_FULL_BASE_URL=https://$(echo ${GITHUB_REPOSITORY_OWNER}).github.io//$(echo ${GITHUB_REPOSITORY##*/})" >> $GITHUB_ENV | |
echo "NUXT_PUBLIC_COMMIT_BASE_URL=https://github.com/MusicOnline/AK-Dataknights/commit" >> $GITHUB_ENV | |
- name: Detect package manager | |
id: detect-package-manager | |
run: | | |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then | |
echo "manager=yarn" >> $GITHUB_OUTPUT | |
echo "command=install" >> $GITHUB_OUTPUT | |
exit 0 | |
elif [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then | |
echo "manager=pnpm" >> $GITHUB_OUTPUT | |
echo "command=install" >> $GITHUB_OUTPUT | |
exit 0 | |
elif [ -f "${{ github.workspace }}/package.json" ]; then | |
echo "manager=npm" >> $GITHUB_OUTPUT | |
echo "command=ci" >> $GITHUB_OUTPUT | |
exit 0 | |
else | |
echo "Unable to determine packager manager" | |
exit 1 | |
fi | |
# Must be done before Setup Node | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
if: ${{ steps.detect-package-manager.outputs.manager == 'pnpm' }} | |
with: | |
version: latest | |
run_install: false | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: ${{ steps.detect-package-manager.outputs.manager }} | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
dist | |
.nuxt | |
key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }} | |
restore-keys: | | |
${{ runner.os }}-nuxt-build- | |
- name: Install dependencies | |
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
- name: Prepare nuxt (postinstall) | |
run: ${{ steps.detect-package-manager.outputs.manager }} run prepare-nuxt | |
- name: Generate static site | |
run: ${{ steps.detect-package-manager.outputs.manager }} run build | |
env: | |
NODE_OPTIONS: --max_old_space_size=8192 | |
NITRO_PRESET: github_pages | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: .output/public | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |