feat(works): 新增关于 meet-admin 的作品展示 #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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Build job to build Vue.js project | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
# Set up Node.js environment using .nvmrc file and cache pnpm | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
# Two cache methods choose one | |
cache: pnpm | |
# Two cache methods choose one | |
# Cache pnpm store to speed up build | |
# - name: Cache pnpm | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.pnpm-store | |
# key: pnpm-cache-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pnpm- | |
# Install dependencies using pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build the project | |
run: pnpm build | |
# List dist directory to confirm build output | |
- name: List dist directory | |
run: ls -alh | |
# Upload dist directory as artifact | |
- name: Upload dist directory | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./docs/.vitepress/dist | |
# Deploy job to transfer build files to Windows server | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Download dist files from build job | |
- name: Download dist files | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
# List current directory to confirm dist files are downloaded | |
- name: List current directory | |
run: ls -alh | |
# Transfer files to Windows server using SCP | |
- name: Transfer files to server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: ./dist/ | |
target: C:/website/blog | |
strip_components: 2 |