Skip to content

Commit aa81fbc

Browse files
add gh actions for building and publishing jar
1 parent 405745a commit aa81fbc

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
pull_request:
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
docker:
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Login to ghcr.io
28+
if: github.event_name != 'pull_request'
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Docker meta
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
- name: Build and push
42+
id: push
43+
uses: docker/build-push-action@v6
44+
with:
45+
context: .
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
50+
- name: Generate artifact attestation
51+
if: github.event_name != 'pull_request'
52+
uses: actions/attest-build-provenance@v2
53+
with:
54+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
55+
subject-digest: ${{ steps.push.outputs.digest }}
56+
push-to-registry: true

0 commit comments

Comments
 (0)