Move to Vite.js #1
Workflow file for this run
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: Site workflow | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
CI: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node: [20] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/pnpm.lock')) }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: pnpm install | |
- name: Set up environment | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
sudo timedatectl set-timezone "Asia/Shanghai" | |
mkdir -p ~/.ssh | |
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Generate Site | |
run: pnpm build | |
- name: Deploy to GitHub Pages | |
run: | | |
cd ./dist | |
git config user.name slivermoe | |
git config user.email [email protected] | |
git add . | |
current_time=`date '+%Y-%m-%d %H:%m:%S'` | |
git branch -M gh-pages | |
git commit -m "Updated at $current_time" | |
git push -u origin gh-pages |