add 增加禁用或删除作业时,取消执行中的任务的选项 #1 && fix 刚创建/启用作业就禁用/删除作业时,已启动的任务还继续执行的问题 #4
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: 构建 | |
on: | |
push: | |
branches: [ 'main' ] | |
paths: [ 'version.txt' ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出仓库代码 | |
uses: actions/checkout@v4 | |
- name: 获取版本号 | |
run: | | |
versions=$(head -n 1 version.txt) | |
tagList="" | |
IFS=',' read -ra versionList <<< "$versions" | |
cuVersion="${versionList[0]}" | |
for version in "${versionList[@]}"; do | |
tagList+="dr34m/tao-sync:$version," | |
done | |
tagList=${tagList%?} | |
echo "tagList=$tagList" >> $GITHUB_ENV | |
echo "version=$cuVersion" >> $GITHUB_ENV | |
- name: 安装Node.js 14.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "14.x" | |
- name: 安装依赖并构建前端 | |
run: | | |
sed -i "s/__version_placeholder__/$version/g" frontend/src/views/page/setting/index.vue | |
cd frontend | |
npm install | |
npm run build | |
- name: 设置QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: 设置Docker BuildX | |
uses: docker/setup-buildx-action@v3 | |
- name: 登录到DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: dr34m | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 构建并推送 | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.tagList }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le | |
- name: 打tag | |
if: ${{ !contains(env.version, 'dev') && !contains(env.version, 'pre') }} | |
run: | | |
git config --local user.email "1416814478@qq.com" | |
git config --local user.name "dr34-m" | |
git tag -a $version -m "release $version" | |
- name: 推送tag | |
if: ${{ !contains(env.version, 'dev') && !contains(env.version, 'pre') }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |