From 018b9f847ad8dd7efbc6d21bee226b4186d9d463 Mon Sep 17 00:00:00 2001 From: Michael Chong Date: Sat, 18 Nov 2023 16:36:41 +0000 Subject: [PATCH 1/2] clean up actions --- .github/workflows/docker-build.yml | 18 -------------- ...ker-publish.yml => docker-gh--publish.yml} | 0 ...ker-release.yml => docker-hub-release.yml} | 24 ++++++++++++------- 3 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/docker-build.yml rename .github/workflows/{docker-publish.yml => docker-gh--publish.yml} (100%) rename .github/workflows/{docker-release.yml => docker-hub-release.yml} (67%) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml deleted file mode 100644 index 8529334..0000000 --- a/.github/workflows/docker-build.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-gh--publish.yml similarity index 100% rename from .github/workflows/docker-publish.yml rename to .github/workflows/docker-gh--publish.yml diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-hub-release.yml similarity index 67% rename from .github/workflows/docker-release.yml rename to .github/workflows/docker-hub-release.yml index 1b9b278..ff93af7 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-hub-release.yml @@ -4,11 +4,18 @@ # documentation. # Source: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images -name: Publish Docker image +name: Publish image to Docker Hub on: - release: - types: [published] + workflow_dispatch: + push: + branches: + - 'main' + tags: + - 'v*' + pull_request: + branches: + - 'main' jobs: push_to_registry: @@ -16,24 +23,25 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + if: github.event_name != 'pull_request' + uses: uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: wildcat/scylla - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v5 with: context: . - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 73d64c60da9d0e2b907a71fd1d4c3f5e4936ac49 Mon Sep 17 00:00:00 2001 From: Michael Chong Date: Sat, 18 Nov 2023 16:39:43 +0000 Subject: [PATCH 2/2] rm --- .../workflows/{docker-gh--publish.yml => docker-gh-publish.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{docker-gh--publish.yml => docker-gh-publish.yml} (99%) diff --git a/.github/workflows/docker-gh--publish.yml b/.github/workflows/docker-gh-publish.yml similarity index 99% rename from .github/workflows/docker-gh--publish.yml rename to .github/workflows/docker-gh-publish.yml index abf66ed..96730ec 100644 --- a/.github/workflows/docker-gh--publish.yml +++ b/.github/workflows/docker-gh-publish.yml @@ -1,4 +1,4 @@ -name: Docker +name: Docker (GitHub Packages) # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by