Skip to content

更新GitHub Actions工作流:构建和部署流程优化 #16

更新GitHub Actions工作流:构建和部署流程优化

更新GitHub Actions工作流:构建和部署流程优化 #16

name: 构建和部署
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 检出仓库
uses: actions/checkout@v2
- name: 设置Node.js
uses: actions/setup-node@v2
with:
node-version: "19"
- name: 下载pnpm
run: npm install -g pnpm
- name: 安装依赖
run: pnpm install
- name: 构建项目
run: pnpm run build
- name: 设置Docker Buildx
uses: docker/setup-buildx-action@v1
- name: 登录Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 清除Docker缓存
run: |
echo "清除Docker缓存..."
docker builder prune -a --filter "dangling=true"
- name: 构建并推送Docker镜像
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: wu529778790/wallpaper.shenzjd.com:latest