Skip to content

Commit 0567a93

Browse files
committed
private image
1 parent cb52c06 commit 0567a93

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Infra: Build Private Image"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: ['labeled']
7+
8+
permissions:
9+
id-token: write
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
build:
15+
runs-on:
16+
- self-hosted
17+
- build
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.event.pull_request.head.sha }}
22+
token: ${{ github.token }}
23+
- name: get branch name
24+
id: extract_branch
25+
run: |
26+
tag='${{ github.event.pull_request.number }}'
27+
echo "tag=${tag}" >> $GITHUB_OUTPUT
28+
- name: Set up JDK
29+
uses: actions/setup-java@v4
30+
with:
31+
java-version: '21'
32+
distribution: 'zulu'
33+
cache: 'maven'
34+
- name: Build
35+
id: build
36+
run: |
37+
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA
38+
./mvnw -B -V -ntp clean package -Pprod -DskipTests
39+
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
40+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
41+
- uses: sainsburys-tech/bosun-actions-setup@v1
42+
name: Setup
43+
id: setup
44+
with:
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
job-name: "build / build"
47+
- name: Build and push
48+
id: buildpush
49+
uses: docker/build-push-action@v2
50+
with:
51+
push: true
52+
build-args: |
53+
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
54+
tags: ${{ fromJson(steps.setup.outputs.dockerParams).tags }}
55+
context: ${{ fromJson(steps.setup.outputs.dockerParams).context }}/api
56+
- name: make comment with private deployment link
57+
uses: peter-evans/create-or-update-comment@v4
58+
with:
59+
issue-number: ${{ github.event.pull_request.number }}
60+
body: |
61+
Image published at ${{ fromJson(steps.setup.outputs.dockerParams).tags }}

0 commit comments

Comments
 (0)