优化github build

This commit is contained in:
xxx 2023-11-14 14:10:22 +08:00
parent 9f27aaac42
commit 3ea07739d1

View File

@ -6,9 +6,12 @@ on:
- main
- dev
- 'feat/**'
tags:
- '*'
env:
IMAGE_FQDN: registry.cn-hangzhou.aliyuncs.com/playedu/api
IMAGE_TAG: ''
jobs:
build-and-push:
@ -33,4 +36,16 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_FQDN }}:1.4
${{ env.IMAGE_FQDN }}:${{ env.IMAGE_TAG }}
env:
IMAGE_TAG: ${{ startsWith(github.ref, 'refs/heads/main') && 'latest' || startsWith(github.ref, 'refs/heads/dev') && 'dev' || github.ref_slug }}
if: startsWith(github.ref, 'refs/heads/')
- name: Build with Tag
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_FQDN }}:${{ github.ref }}
if: startsWith(github.ref, 'refs/tags/')