Skip to content

Commit 367dbfc

Browse files
committed
Segregate image names for develop/master branches 🙌
1 parent 89dd0a5 commit 367dbfc

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/docker-publish.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ jobs:
1616
uses: actions/setup-java@v1
1717
with:
1818
java-version: ${{ env.JAVA_VERSION }}
19+
- name: Extract branch name
20+
shell: bash
21+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
22+
id: extract_branch
1923
- uses: actions/checkout@v2
2024
with:
2125
fetch-depth: 0
2226
- name: Build and Publish Docker Image
2327
env:
2428
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
2529
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
30+
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
2631
run: ./gradlew jib

application/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ repositories {
1919
}
2020
}
2121

22+
var outputImage = 'togetherjava.duckdns.org:5001/togetherjava/tjbot:' + System.getenv('BRANCH_NAME') ?: 'latest'
23+
2224
jib {
2325
from.image = 'adoptopenjdk/openjdk16:alpine-slim'
2426
to {
25-
image = 'togetherjava.duckdns.org:5001/togetherjava/tjbot:latest'
27+
image = outputImage
2628
auth {
2729
username = System.getenv('REGISTRY_USER') ?: ''
2830
password = System.getenv('REGISTRY_PASSWORD') ?: ''

0 commit comments

Comments
 (0)