Signed-off-by: Tenny <joel.shu@qq.com> #4
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 Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [21] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build Site | |
run: npm run build | |
- name: Deploy Site | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git checkout gh-pages | |
cp -r docs/* . | |
git add . | |
git commit -m "Deploy to GitHub Pages" | |
git push |