From 0880e3703d146f0677d9d18dd88b7a3bd933a729 Mon Sep 17 00:00:00 2001 From: Dan Meyers <20687081+danjbh@users.noreply.github.com> Date: Tue, 15 Sep 2020 13:45:14 -0700 Subject: [PATCH] Fixing Docker Hub publishes (#7) * Updating conditional to build-and-push Github workflow * Fixing 'on push' triggers in Github build job * Adding proper wildcard matching using regex * Fixing up github expressoins * One more fix.. for real this time. * Adding a missing character... * Updating auto-release to use public Github access token * Finalizing a few things... * Fixing github.event.release.action * Fixing github.event.release.action * Fixing github.event.release.action * Fixing github.event.release.action * More testing * Final logic tweaks * Fixing YAML formatting Co-authored-by: Dan Meyers --- .github/workflows/auto-release.yml | 2 +- .github/workflows/docker.yml | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 6a2d30b..98c8663 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -16,4 +16,4 @@ jobs: prerelease: false config-name: auto-release.yml env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index dc310e0..686a9b7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,8 +1,5 @@ name: "docker" on: - push: - branches: - - master pull_request: types: [opened, synchronize, reopened] release: @@ -15,7 +12,7 @@ jobs: - name: "Checkout source code at current commit" uses: actions/checkout@v2 - name: Prepare tags for Docker image - if: (github.event_name != 'pull_request' && github.ref == 'master') || github.event.pull_request.head.repo.full_name == github.repository + if: (github.event_name == 'release' && github.event.action == 'created') || github.event.pull_request.head.repo.full_name == github.repository id: prepare run: | TAGS=${{ github.repository }}:sha-${GITHUB_SHA:0:7} @@ -34,7 +31,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - if: (github.event_name != 'pull_request' && github.ref == 'master') || github.event.pull_request.head.repo.full_name == github.repository + if: (github.event_name == 'release' && github.event.action == 'created') || github.event.pull_request.head.repo.full_name == github.repository uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -43,5 +40,5 @@ jobs: id: docker_build uses: docker/build-push-action@v2 with: - push: ${{ (github.event_name != 'pull_request' && github.ref == 'master') || github.event.pull_request.head.repo.full_name == github.repository }} + push: ${{ (github.event_name == 'release' && github.event.action == 'created') || github.event.pull_request.head.repo.full_name == github.repository }} tags: ${{ steps.prepare.outputs.tags }}