upgrade to actions-gh-pages@v4 #6
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: Build Router | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'website/docs/**' | |
- 'website/src/**' | |
- 'website/blog/**' | |
- 'website/docusaurus.config.js' | |
- 'website/crowdin.yaml' | |
- '.github/workflows/deploy.yml' | |
push: | |
branches: | |
- main | |
paths: | |
- 'website/docs/**' | |
- 'website/src/**' | |
- 'website/blog/**' | |
- 'website/docusaurus.config.js' | |
- '.github/workflows/deploy.yml' | |
- 'website/static/**' | |
- 'website/sidebars.js' | |
env: | |
NODE_OPTIONS: --max_old_space_size=4096 | |
jobs: | |
build: | |
name: Build Website | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Set up Node.js without specifying working-directory | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
# Install dependencies (npm ci) in the website directory | |
- name: Install dependencies (npm ci) | |
run: | | |
npm ci | |
working-directory: website | |
# Add Crowdin sync step to download translations before building | |
- name: Sync translations from Crowdin | |
run: | | |
npm run crowdin:sync | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
working-directory: website | |
# Test build website in the website directory | |
- name: Test build website | |
run: | | |
npm run build | |
working-directory: website | |
# Upload build artifact | |
- name: Upload build artifact | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: github-pages | |
path: website/build | |
deploy: | |
name: Deploy to GitHub Pages | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
permissions: | |
contents: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
path: website/build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: website/build |