Skip to content

Commit

Permalink
Push Docker image on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mrueg committed Apr 3, 2023
1 parent eade059 commit 429bbf9
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -65,7 +65,7 @@ jobs:
run: |
make build
# Build Dockerimage
# Build and push Dockerimage
ci-docker-build:
name: ci-docker-build
runs-on: ubuntu-latest
Expand All @@ -76,8 +76,25 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
- name: Build only (on commits)
uses: docker/build-push-action@v4
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
push: false
tags: kovetskiy/mark:latest

- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push (on tag)
uses: docker/build-push-action@v4
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
push: true
tags: |
kovetskiy/mark:${{ steps.extract_tag.outputs.tag }}
kovetskiy/mark:latest

0 comments on commit 429bbf9

Please sign in to comment.