Skip to content

Commit d676b3a

Browse files
committed
feat: add build job
1 parent e6e2392 commit d676b3a

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflow/build.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build:
14+
name: Build & Push Docker Image
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set up JDK 21
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: "21"
28+
distribution: "temurin"
29+
30+
- name: Setup Gradle
31+
uses: gradle/actions/setup-gradle@v4
32+
33+
- name: Extract tag version
34+
id: version
35+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
36+
37+
- name: Log in to GitHub Container Registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ${{ env.REGISTRY }}
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Build and push image via Jib
45+
run: |
46+
./gradlew jib \
47+
-Djib.to.image=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
48+
-Djib.to.tags=${{ steps.version.outputs.VERSION }},latest \
49+
-Djib.to.auth.username=${{ github.actor }} \
50+
-Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }} \
51+
-Pversion=${{ steps.version.outputs.VERSION }}

0 commit comments

Comments
 (0)