Skip to content

Commit

Permalink
update(builder.yaml)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akimio521 committed Jul 6, 2024
1 parent 42033ed commit faf4d42
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ on:
description: '版本号,用于 Docker 标签'
required: false
IS_USE_LATEST_TAG:
description: '是否使用"latest"标签'
required: false
description: '是否使用latest标签'
default: true
type: boolean
IS_USE_VERSION_TAG:
description: '是否使用版本标签'
default: true
type: boolean

env:
IS_USE_LATEST_TAG: false
IS_APP_VERSION_CHANGE: false
IS_USE_VERSION_TAG: false

jobs:
Docker-build:
Expand All @@ -31,36 +34,33 @@ jobs:
echo "APP_VERSION=$(cat app/version.py | sed -ne 's/APP_VERSION\s=\s"v\(.*\)"/\1/gp')" >> $GITHUB_ENV
echo "DEV_TAG=Dev-$(date +"%Y%m%d")" >> $GITHUB_ENV
- name: Check Version Change
run: |
if git diff --name-only ${{ github.sha }} | grep 'version.py'; then
echo "IS_APP_VERSION_CHANGE=true" >> $GITHUB_ENV
if git diff --name-only ${{ github.sha }} | grep 'app/version.py'; then
echo "IS_USE_LATEST_TAG=true" >> $GITHUB_ENV
echo "IS_USE_VERSION_TAG=true" >> $GITHUB_ENV
fi
- name: Get Version from Input
if: ${{ github.event.inputs.APP_VERSION}}
run: |
echo "使用传入版本号覆盖默认版本号"
echo "传入版本号:${{ github.event.inputs.APP_VERSION }}"
echo "APP_VERSION=${{ github.event.inputs.APP_VERSION }}" >> $GITHUB_ENV
echo "IS_APP_VERSION_CHANGE=true" >> $GITHUB_ENV
- name: Use Latest Tag
if: ${{ github.event.inputs.IS_USE_LATEST_TAG }}
run: |
echo "使用latest标签"
echo "IS_USE_LATEST_TAG=true" >> $GITHUB_ENV
- name: Use Latest Tag
if: ${{ github.event.inputs.IS_USE_VERSION_TAG }}
run: |
echo "使用版本标签"
echo "IS_USE_VERSION_TAG=true" >> $GITHUB_ENV
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/autofilm
tags: |
type=raw,value=latest,enable=${{ env.IS_USE_LATEST_TAG }}
type=raw,value=${{ env.APP_VERSION }},enable=${{ env.IS_APP_VERSION_CHANGE }}
type=raw,value=${{ env.APP_VERSION }},enable=${{ env.IS_USE_VERSION_TAG }}
type=raw,value=${{ env.DEV_TAG }},enable=true
- name: Set up QEMU
Expand Down

0 comments on commit faf4d42

Please sign in to comment.