From 15501e80659439dd6cf6daaab403fadd835c8134 Mon Sep 17 00:00:00 2001 From: TMKnight <548588+tmknight@users.noreply.github.com> Date: Sat, 8 Jul 2023 13:42:10 -0400 Subject: [PATCH] Refine action workflows --- .github/workflows/docker-publish.yml | 27 ++++++++++++++++++--------- .github/workflows/github-package.yml | 27 +++++++++++++++++++-------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 90449e6..2f2af5f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -85,18 +85,12 @@ jobs: run: | echo "tag=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_ENV echo "ver=org.opencontainers.image.version=latest" >> $GITHUB_ENV - - ## Set tag/label off schedule - - if: github.event_name != 'schedule' - name: Conditional(Set tag as called) - run: | - echo "tag=${{ steps.meta.outputs.tags }}" >> $GITHUB_ENV - echo "ver=org.opencontainers.image.version=" >> $GITHUB_ENV # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - - name: Build and push Docker image - id: build-and-push + - if: github.event_name == 'schedule' + name: Build and push Docker image on schedule + id: build-and-push-schedule uses: docker/build-push-action@v4 with: context: . @@ -110,3 +104,18 @@ jobs: ${{ env.ver }} cache-from: type=gha cache-to: type=gha,mode=max + + - if: github.event_name != 'schedule' + name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + file: ${{ env.IMAGE }}.dockerfile + build-args: ${{ env.BUILD_ARGS }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/github-package.yml b/.github/workflows/github-package.yml index 07a0ffc..89ea0a1 100644 --- a/.github/workflows/github-package.yml +++ b/.github/workflows/github-package.yml @@ -96,16 +96,11 @@ jobs: echo "tag=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_ENV echo "ver=org.opencontainers.image.version=latest" >> $GITHUB_ENV - ## Set tag/label off schedule - - if: github.event_name != 'schedule' - name: Conditional(Set tag as called) - run: | - echo "tag=${{ steps.meta.outputs.tags }}" >> $GITHUB_ENV - echo "ver=org.opencontainers.image.version=" >> $GITHUB_ENV ## Build and push Docker image with Buildx (don't push on PR) ## https://github.com/docker/build-push-action - - name: Build and push Docker image - id: build-and-push + - if: github.event_name == 'schedule' + name: Build and push Docker image on schedule + id: build-and-push-schedule uses: docker/build-push-action@v4 with: context: . @@ -121,6 +116,22 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max + - if: github.event_name != 'schedule' + name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + file: ${{ env.IMAGE }}.dockerfile + build-args: ${{ env.BUILD_ARGS }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Multi-arch NordVPN for Docker + cache-from: type=gha + cache-to: type=gha,mode=max + ## Sign the resulting Docker image digest except on PRs. ## This will only write to the public Rekor transparency log when the Docker ## repository is public to avoid leaking data. If you would like to publish