Skip to content

Commit

Permalink
Publish image on release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkleiven committed Dec 3, 2023
1 parent 999c516 commit 5e58d20
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/dockerize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
release:
types: [published]

permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-image-and-publish:
name: Publish Docker Image to Docker Hub
Expand All @@ -23,8 +29,23 @@ jobs:
- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Dockerize
run: docker build -f ./Dockerfile -t load-flow-service:${{ github.event.release.tag_name }}
- name: Docker login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Meta data extraction
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Publish
run: echo "No publishing action implemented"
- name: Push image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 5e58d20

Please sign in to comment.