From aef0b2a26edfcc6732053bcebc396d002f5f0818 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Wed, 13 Sep 2023 08:12:46 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8DGITHUB=5FREF=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_docker_image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml index 1af9a50..25e094f 100644 --- a/.github/workflows/build_docker_image.yml +++ b/.github/workflows/build_docker_image.yml @@ -16,13 +16,13 @@ jobs: - name: judge has env GITHUB_REF # 如果没有GITHUB_REF环境变量,则把github.ref变量赋值给GITHUB_REF run: | if [ -z "$GITHUB_REF" ]; then - echo "GITHUB_REF=${{ github.ref }}" >> $GITHUB_ENV + export GITHUB_REF=${{ github.ref }} fi - name: Check GITHUB_REF env run: echo $GITHUB_REF - name: Get version id: get_version - if: startsWith(env.GITHUB_REF, 'refs/tags/') && startsWith(github.repository, 'RockChinQ/QChatGPT') + if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/QChatGPT') run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Build # image name: rockchin/qchatgpt: run: docker build --network=host -t rockchin/qchatgpt:${{ steps.get_version.outputs.VERSION }} -t rockchin/qchatgpt:latest . @@ -30,9 +30,9 @@ jobs: run: docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} - name: Push image - if: startsWith(env.GITHUB_REF, 'refs/tags/') && startsWith(github.repository, 'RockChinQ/QChatGPT') + if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/QChatGPT') run: docker push rockchin/qchatgpt:${{ steps.get_version.outputs.VERSION }} - name: Push image - if: startsWith(env.GITHUB_REF, 'refs/tags/') && startsWith(github.repository, 'RockChinQ/QChatGPT') + if: (startsWith(env.GITHUB_REF, 'refs/tags/')||startsWith(github.ref, 'refs/tags/')) && startsWith(github.repository, 'RockChinQ/QChatGPT') run: docker push rockchin/qchatgpt:latest