Skip to content

chore: 更新版本号为1.0.0 #21

chore: 更新版本号为1.0.0

chore: 更新版本号为1.0.0 #21

name: 构建和部署
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 检出仓库
uses: actions/checkout@v2
with:
fetch-depth: 0 # 需要获取所有历史记录以创建标签
- 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: 获取版本号
id: version
run: |
echo "::set-output name=new-version::$(cat VERSION)"
- name: 更新版本号并推送更改
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
echo ${{ steps.version.outputs.new-version }} > VERSION
git config --global user.name 'wu529778790'
git config --global user.email '[email protected]'
git remote set-url origin https://${GIT_TOKEN}@github.com/${{ github.repository }}
git add VERSION
git commit -m "chore: bump version to ${{ steps.version.outputs.new-version }}"
git push
git push origin --tags
- name: 构建并推送Docker镜像
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: wu529778790/wallpaper.shenzjd.com:${{ steps.version.outputs.new-version }}