@@ -7,6 +7,12 @@ permissions:
77on :
88 push :
99 branches : [main]
10+ workflow_dispatch :
11+ inputs :
12+ branch :
13+ description : ' Branch to build'
14+ required : true
15+ type : string
1016
1117jobs :
1218 merge-build :
2430 version : ${{ steps.get_version.outputs.version }}
2531 steps :
2632 - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
33+ with :
34+ ref : ${{ github.event.inputs.branch || github.ref }}
2735 - uses : actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
2836 with :
2937 java-version : 21
@@ -129,6 +137,7 @@ jobs:
129137 name : lambda-layer-${{ matrix.arch }}
130138 path : sdk/build/distributions/sdk-*.zip
131139 publish-docs :
140+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
132141 permissions :
133142 contents : write
134143 runs-on : ubuntu-latest
@@ -151,6 +160,7 @@ jobs:
151160 GRGIT_PASS : ${{ secrets.GITHUB_TOKEN }}
152161 NVD_API_KEY : ${{ secrets.NVD_API_KEY }}
153162 publish-snapshot :
163+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
154164 runs-on : ubuntu-latest
155165 name : " Snapshot"
156166 steps :
@@ -185,6 +195,8 @@ jobs:
185195 name : " Base image"
186196 steps :
187197 - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
198+ with :
199+ ref : ${{ github.event.inputs.branch || github.ref }}
188200 - uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
189201 - name : Log in to container registry
190202 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
@@ -211,12 +223,22 @@ jobs:
211223 with :
212224 name : package-toolkit-runtime-arm64
213225 path : ./containers/base/arm64/assembly
226+ - name : Determine image tags
227+ id : tags
228+ run : |
229+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
230+ # For manual runs, use version and branch name (sanitized)
231+ BRANCH_NAME=$(echo "${{ github.event.inputs.branch }}" | sed 's/[^a-zA-Z0-9._-]/-/g')
232+ echo "tags=ghcr.io/atlanhq/atlan-java:${{ needs.merge-build.outputs.version }}-${BRANCH_NAME}" >> $GITHUB_OUTPUT
233+ else
234+ # For main branch pushes, use version and latest
235+ echo "tags=ghcr.io/atlanhq/atlan-java:${{ needs.merge-build.outputs.version }},ghcr.io/atlanhq/atlan-java:latest" >> $GITHUB_OUTPUT
236+ fi
214237 - name : Build and publish container image
215- if : ${{ github.ref == 'refs/heads/main'}}
216238 uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
217239 with :
218240 push : true
219- tags : ghcr.io/atlanhq/atlan-java: ${{ needs.merge-build .outputs.version }}, ghcr.io/atlanhq/atlan-java:latest
241+ tags : ${{ steps.tags .outputs.tags }}
220242 context : ./containers/base
221243 platforms : linux/amd64,linux/arm64
222244 custom-package-images :
@@ -249,3 +271,4 @@ jobs:
249271 with :
250272 package_name : ${{ matrix.package_name }}
251273 version : ${{ needs.merge-build.outputs.version }}
274+ branch : ${{ github.event.inputs.branch || '' }}
0 commit comments