Skip to content

Commit

Permalink
Build Docker-Images also on develop-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ja-fra committed Apr 22, 2024
1 parent fb0c570 commit 949df27
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions .github/workflows/compile-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
Build-and-Deploy:
name: "Build and Push Docker Image"
runs-on: ubuntu-latest
if: github.ref_name == 'main' || github.event.inputs.dockerTag != ''
if: contains(fromJSON('["main", "develop"]'), github.ref_name) || github.event.inputs.dockerTag != ''
needs:
- Compile-and-Test
steps:
Expand All @@ -51,20 +51,34 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- name: Generate additional Docker-Tags
run: |
TAGS=${BRANCH}
if [ "$BRANCH" == "$MAIN_BRANCH" ]; then
TAGS="latest,$TAGS"
fi
if [ -n "$EVENT_PARAM" ]; then
TAGS="$EVENT_PARAM"
fi
echo "Generated Docker-Tags: $TAGS"
echo "TAGS=$TAGS" >> "$GITHUB_ENV"
env:
BRANCH: ${{ github.ref_name }}
MAIN_BRANCH: ${{ github.event.repository.default_branch }}
EVENT_PARAM: ${{ github.event.inputs.dockerTag }}
- name: Build JIB container and publish to GitHub Packages
run:
TAG=${{github.event.inputs.dockerTag}} &&
./mvnw -B -U
--no-transfer-progress
clean verify jib:build
-Drevision=${{github.run_number}}
-Dchangelist=
-Dsha1=.${GITHUB_SHA:0:7}
-Dquick
-Ddocker.namespace=${DOCKER_NAMESPACE,,}
-Djib.to.tags=${TAG:=latest}
-Djib.to.auth.username=${{ github.actor }}
-Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }}
--no-transfer-progress
clean verify jib:build
-Drevision=${{github.run_number}}
-Dchangelist=
-Dsha1=.${GITHUB_SHA:0:7}
-Dquick
-Ddocker.namespace=${DOCKER_NAMESPACE,,}
-Djib.to.tags=${TAGS}
-Djib.to.auth.username=${{ github.actor }}
-Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }}
env:
DOCKER_NAMESPACE: ghcr.io/${{ github.repository_owner }}

Expand Down

0 comments on commit 949df27

Please sign in to comment.