Skip to content

feat: 前端高级阶段文档 #33

feat: 前端高级阶段文档

feat: 前端高级阶段文档 #33

Workflow file for this run

name: Deploy VitePress site to Docker
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 9.11.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install
- name: Build with VitePress
run: pnpm build
- name: Push Image
env:
DOCKER_USERNAME: ${{ secrets.CODING_USER }}
DOCKER_PASSWORD: ${{ secrets.CODING_PASS }}
DOCKER_REGISTRY: ${{ secrets.CODING_SERVER }}
SHA: ${{ github.sha }}
run: |
docker build . -t doc-v3:latest
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY
docker tag doc-v3:latest $DOCKER_REGISTRY/mineadmin/mineadmin/doc-v3:$SHA
docker push $DOCKER_REGISTRY/mineadmin/mineadmin/doc-v3:$SHA
# 部署工作
deploy:
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Build Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
export CODING_SERVER=${{ secrets.CODING_SERVER }}
export SHA=${{ github.sha }}
export CODING_USER=${{ secrets.CODING_USER }}
export CODING_PASS=${{ secrets.CODING_PASS }}
sh /opt/www/deploy-doc-v3.sh