From 2a1adb2e0ececb9ce322e4753bd963248ce4f122 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Wed, 30 Jun 2021 23:02:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0action=20yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ build.yml | 2 +- .github/workflows/docker.yml | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ build.yml b/.github/workflows/ build.yml index 1a4d9bf8..79fa51e1 100644 --- a/.github/workflows/ build.yml +++ b/.github/workflows/ build.yml @@ -1,4 +1,4 @@ -name: build static +name: Build Static on: push: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 517507a9..1464ced1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,8 +1,9 @@ name: Publish Docker Image on: push: - tags: + branches: - v* + - master jobs: build: @@ -14,10 +15,8 @@ jobs: with: fetch-depth: 0 - # https://github.com/docker/setup-qemu-action - name: Set up QEMU uses: docker/setup-qemu-action@v1 - # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -35,19 +34,19 @@ jobs: run: | docker buildx build --build-arg SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" --output "type=image,push=true" --platform=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x --tag whyour/qinglong:latest docker/ - - name: Replace tag without `v` - if: startsWith(github.ref, 'refs/tags/') + - name: Replace branch without `v` + if: startsWith(github.ref, 'refs/heads/') uses: actions/github-script@v1 id: version with: script: | - return context.payload.ref.replace(/\/?refs\/tags\/v/, '') + return context.payload.ref.replace(/\/?refs\/heads\/v/, '') result-encoding: string - name: Docker buildx image and push on release env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/heads/') run: | docker buildx build --build-arg SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" --output "type=image,push=true" --platform=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x --tag whyour/qinglong:${{steps.version.outputs.result}} docker/ docker buildx build --build-arg SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" --output "type=image,push=true" --platform=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x --tag whyour/qinglong:latest docker/