refactor: 修改中文为主要语言,修改配置文件为TypeScript #47
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 and deploy website | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Check cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
- name: Install dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build website | |
run: npm run build | |
- name: Add .nojekyll | |
run: touch ./dist/.nojekyll | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./dist | |
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 |