-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#329 update dependency versions and trigger on new tag starting with v
- Loading branch information
1 parent
52b5b14
commit 3a405c6
Showing
1 changed file
with
16 additions
and
20 deletions.
There are no files selected for viewing
36 changes: 16 additions & 20 deletions
36
...hub/workflows/build-war-and-container.yml → ...hub/workflows/build-and-publish-image.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,54 @@ | ||
name: Build .war and Docker container | ||
name: Build JAR and Docker image and publish to GHCR | ||
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ v* ] | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- assigned | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 21 | ||
- name: Build with Maven | ||
run: ./mvnw -B package | ||
- name: Publish to Github | ||
run: ./mvnw -B -Dmaven.test.skip=true deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: | ||
- actions/checkout@v4 | ||
- actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' # See 'Supported distributions' for available options | ||
java-version: '21' | ||
run: ./mvnw spring-boot:build-image --batch-mode --no-transfer-progress | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
- name: Extract metadata (tags, labels) to use for Docker (incl. image tags) | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | ||
- name: Build Docker image | ||
run: ./mvnw -B -Dmaven.test.skip=true -Dspring-boot.build-image.imageName=ghcr.io/hbtgmbh/salat:ci spring-boot:build-image | ||
- name: Push Docker image with ci tag (required by tag-push-action) | ||
run: docker push ghcr.io/hbtgmbh/salat:ci | ||
- name: Push Docker image | ||
uses: akhilerm/[email protected].0 | ||
uses: akhilerm/[email protected].1 | ||
with: | ||
src: ghcr.io/hbtgmbh/salat:ci | ||
src: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
dst: | | ||
${{ steps.meta.outputs.tags }} | ||