From 5211ab111e4cb5f973d88ebd295bfb8b04043a08 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Mon, 25 Nov 2024 19:54:29 +0800 Subject: [PATCH] refactor(publish-docker): restrict image push to tags only --- .github/workflows/publish-docker.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index dc7080bf..3ef18ef1 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -2,9 +2,9 @@ name: Publish Docker image on: push: - branches: - - main - - master + # branches: + # - main + # - master tags: - 'v*' workflow_dispatch: @@ -36,6 +36,7 @@ jobs: run: echo "${{ secrets.ACCESS_TOKEN }}" | sudo docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Push image + if: "startsWith(github.ref, 'refs/tags/')" run: | IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME