2424 IMAGE_TAG : unstable
2525 REGISTRY : " " # Empty means default to Docker Hub
2626 PLATFORMS : " linux/amd64,linux/arm64"
27- MASTER_BRANCH_TAG : alpha
2827
2928jobs :
3029 build :
6059
6160 # TODO: add smoke / integration testing here (add "-Pct -DskipIntegrationTests=false")
6261
63- hub-description :
64- needs : build
65- name : Push image descriptions to Docker Hub
66- # Run this when triggered via push or schedule as reused workflow from base / maven unit tests.
67- # Excluding PRs here means we will have no trouble with secrets access. Also avoid runs in forks.
68- if : ${{ github.event_name != 'pull_request' && github.ref_name == 'develop' && github.repository_owner == 'IQSS' }}
69- runs-on : ubuntu-latest
70- steps :
71- - uses : actions/checkout@v4
72- - uses : peter-evans/dockerhub-description@v4
73- with :
74- username : ${{ secrets.DOCKERHUB_USERNAME }}
75- password : ${{ secrets.DOCKERHUB_TOKEN }}
76- repository : gdcc/dataverse
77- short-description : " Dataverse Application Container Image providing the executable"
78- readme-filepath : ./src/main/docker/README.md
79- - uses : peter-evans/dockerhub-description@v4
80- with :
81- username : ${{ secrets.DOCKERHUB_USERNAME }}
82- password : ${{ secrets.DOCKERHUB_TOKEN }}
83- repository : gdcc/configbaker
84- short-description : " Dataverse Config Baker Container Image providing setup tooling and more"
85- readme-filepath : ./modules/container-configbaker/README.md
86-
8762 # Note: Accessing, pushing tags etc. to DockerHub or GHCR will only succeed in upstream because secrets.
8863 # We check for them here and subsequent jobs can rely on this to decide if they shall run.
8964 check-secrets :
@@ -107,13 +82,13 @@ jobs:
10782 needs : check-secrets
10883 name : " Package & Publish"
10984 runs-on : ubuntu-latest
110- # Only run this job if we have access to secrets. This is true for events like push/schedule which run in
85+ # Only run this job if we have access to secrets. This is true for events like push/schedule which run in the
11186 # context of the main repo, but for PRs only true if coming from the main repo! Forks have no secret access.
11287 #
11388 # Note: The team's decision was to not auto-deploy an image on any git push where no PR exists (yet).
114- # Accordingly, only run for push events on branches develop and master .
89+ # Accordingly, only run for push events on the ' develop' branch .
11590 if : needs.check-secrets.outputs.available == 'true' &&
116- ( github.event_name != 'push' || ( github.event_name == 'push' && contains(fromJSON('[" develop", "master"]'), github.ref_name) ))
91+ ( github.event_name != 'push' || ( github.event_name == 'push' && github.ref_name == ' develop' ))
11792 steps :
11893 - name : Checkout and Setup Maven
11994 uses : IQSS/dataverse/.github/actions/setup-maven@develop
@@ -141,16 +116,15 @@ jobs:
141116 - name : Set up QEMU for multi-arch builds
142117 uses : docker/setup-qemu-action@v3
143118
144- - name : Re-set image tag based on branch (if master)
145- if : ${{ github.ref_name == 'master ' }}
119+ - name : Add rolling image tag when pushing to develop
120+ if : ${{ github.event_name == 'push' && github. ref_name == 'develop ' }}
146121 run : |
147- echo "IMAGE_TAG=${{ env.MASTER_BRANCH_TAG }}" >> $GITHUB_ENV
148- echo "BASE_IMAGE_TAG=${{ env.MASTER_BRANCH_TAG }}" >> $GITHUB_ENV
122+ echo "ADDITIONAL_TAGS=-Ddocker.tags.upcoming=$( mvn initialize help:evaluate -Pct -Dexpression=app.image.tag -Dapp.image.tag='${app.image.version}-${base.image.flavor}' -q -DforceStdout )" | tee -a "$GITHUB_ENV"
149123 - name : Re-set image tag and container registry when on PR
150124 if : ${{ github.event_name == 'pull_request' }}
151125 run : |
152- echo "IMAGE_TAG=$(echo "$GITHUB_HEAD_REF" | tr '\\/_:&+,;#*' '-')" >> $GITHUB_ENV
153- echo "REGISTRY='-Ddocker.registry=ghcr.io'" >> $GITHUB_ENV
126+ echo "IMAGE_TAG=$(echo "$GITHUB_HEAD_REF" | tr '\\/_:&+,;#*' '-')" | tee -a " $GITHUB_ENV"
127+ echo "REGISTRY='-Ddocker.registry=ghcr.io'" | tee -a " $GITHUB_ENV"
154128
155129 # Necessary to split as otherwise the submodules are not available (deploy skips install)
156130 - name : Build app and configbaker container image with local architecture and submodules (profile will skip tests)
@@ -162,7 +136,7 @@ jobs:
162136 - name : Deploy multi-arch application and configbaker container image
163137 run : >
164138 mvn
165- -Dapp.image.tag=${{ env.IMAGE_TAG }}
139+ -Dapp.image.tag=${{ env.IMAGE_TAG }} ${{ env.ADDITIONAL_TAGS }}
166140 $( [[ -n "${{ inputs.base-image-ref }}" ]] && echo "-Dbase.image=${{ inputs.base-image-ref }}" )
167141 ${{ env.REGISTRY }} -Ddocker.platforms=${{ env.PLATFORMS }}
168142 -P ct deploy
0 commit comments