From e12cc73d333c9b55c34bcc45cfd7795f17e70739 Mon Sep 17 00:00:00 2001 From: monlor Date: Wed, 29 May 2024 18:28:42 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-build.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index f2c4bc2..235be07 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,4 +1,4 @@ -name: Build and Push Docker Images +name: Build and Push Multi-Architecture Docker Images on: push: @@ -25,11 +25,16 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract version from tag + - name: Determine version and tags id: vars run: | - VERSION=${GITHUB_REF#refs/tags/} - echo "VERSION=$VERSION" >> $GITHUB_ENV + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + echo "IS_TAG=true" >> $GITHUB_ENV + echo "VERSION=$VERSION" >> $GITHUB_ENV + else + echo "IS_TAG=false" >> $GITHUB_ENV + fi - name: Build and push xiaoya-alist uses: docker/build-push-action@v4 @@ -38,7 +43,7 @@ jobs: push: true tags: | ghcr.io/${{ github.repository_owner }}/xiaoya-alist:latest - ghcr.io/${{ github.repository_owner }}/xiaoya-alist:${{ env.VERSION }} + ${{ env.IS_TAG == 'true' && 'ghcr.io/${{ github.repository_owner }}/xiaoya-alist:${{ env.VERSION }}' || '' }} platforms: linux/amd64,linux/arm64 - name: Build and push xiaoya-glue @@ -48,7 +53,7 @@ jobs: push: true tags: | ghcr.io/${{ github.repository_owner }}/xiaoya-glue:latest - ghcr.io/${{ github.repository_owner }}/xiaoya-glue:${{ env.VERSION }} + ${{ env.IS_TAG == 'true' && 'ghcr.io/${{ github.repository_owner }}/xiaoya-glue:${{ env.VERSION }}' || '' }} platforms: linux/amd64,linux/arm64 - name: Build and push xiaoya-emby @@ -58,7 +63,7 @@ jobs: push: true tags: | ghcr.io/${{ github.repository_owner }}/xiaoya-emby:latest - ghcr.io/${{ github.repository_owner }}/xiaoya-emby:${{ env.VERSION }} + ${{ env.IS_TAG == 'true' && 'ghcr.io/${{ github.repository_owner }}/xiaoya-emby:${{ env.VERSION }}' || '' }} platforms: linux/amd64,linux/arm64 - name: Build and push xiaoya-jellyfin @@ -68,5 +73,5 @@ jobs: push: true tags: | ghcr.io/${{ github.repository_owner }}/xiaoya-jellyfin:latest - ghcr.io/${{ github.repository_owner }}/xiaoya-jellyfin:${{ env.VERSION }} + ${{ env.IS_TAG == 'true' && 'ghcr.io/${{ github.repository_owner }}/xiaoya-jellyfin:${{ env.VERSION }}' || '' }} platforms: linux/amd64,linux/arm64 \ No newline at end of file