-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (115 loc) · 3.74 KB
/
maven-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Pseudoniemen Service
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'liberica'
cache: maven
- name: Test with Maven
run: mvn -Ppitest -B verify
build:
if: github.event_name != 'pull_request'
strategy:
fail-fast: true
matrix:
platform: [amd64, arm64]
include:
- platform: amd64
runner: ubuntu-latest
javaarch: x64
- platform: arm64
runner: buildjet-4vcpu-ubuntu-2204-arm
javaarch: aarch64
runs-on: ${{ matrix.runner }}
needs:
- test
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: print arch
run: uname -a
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io/bhuism/pseudoniemenservice
username: bhuism
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/bhuism/pseudoniemenservice
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'liberica'
architecture: ${{ matrix.javaarch }}
java-version: '21'
cache: 'maven'
- name: Buid and publish image via spring build-image
run: |
mvn -Pnative --no-transfer-progress -B -DskipTests spring-boot:build-image -Dspring-boot.build-image.imagePlatform=linux/${{ matrix.platform }} -Dspring-boot.build-image.imageName=ghcr.io/bhuism/pseudoniemenservice:latest-${{ matrix.platform }}
- name: Push
run: |
docker push ghcr.io/bhuism/pseudoniemenservice:latest-${{ matrix.platform }}
# - name: Set up Pack
# uses: buildpacks/github-actions/[email protected]
# with:
# pack-version: 0.35.1
# - name: Build and publish image via pack
# run: |
# pack build ghcr.io/bhuism/pseudoniemenservice:latest-${{ matrix.platform }} \
# --builder docker.io/paketobuildpacks/builder-jammy-buildpackless-tiny \
# --buildpack gcr.io/paketo-buildpacks/java-native-image \
# --publish \
# --platform linux/${{ matrix.platform }} \
# --env BP_NATIVE_IMAGE=true \
# --env BP_MAVEN_ACTIVE_PROFILES=native
manifest-and-push:
runs-on: ubuntu-latest
needs: build
if: success()
steps:
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io/bhuism/pseudoniemenservice
username: bhuism
password: ${{ secrets.GITHUB_TOKEN }}
- name: merge containers and push
run: |
docker manifest create ghcr.io/bhuism/pseudoniemenservice:latest \
ghcr.io/bhuism/pseudoniemenservice:latest-amd64 ghcr.io/bhuism/pseudoniemenservice:latest-arm64
docker manifest push ghcr.io/bhuism/pseudoniemenservice:latest
rollout-restart:
needs: build
runs-on: ubuntu-latest
name: Rollout Restart
steps:
- name: Kubernetes context
uses: Azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: Rollout Restart
run: kubectl -n pseudoniemenservice rollout restart deployment pseudoniemenservice