-
Notifications
You must be signed in to change notification settings - Fork 137
111 lines (95 loc) · 2.98 KB
/
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
name: Publish PKI
on:
push:
branches:
- master
env:
NAMESPACE: ${{ vars.REGISTRY_NAMESPACE || github.repository_owner }}
jobs:
init:
name: Initialization
uses: ./.github/workflows/init.yml
secrets: inherit
if: vars.REGISTRY != ''
publish-maven:
name: Publishing Maven artifacts
needs: init
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Check settings.xml
run: |
cat ~/.m2/settings.xml
- name: Update pom.xml
run: |
sed -i \
-e "s/OWNER/$NAMESPACE/g" \
-e "s/REPOSITORY/pki/g" \
pom.xml
cat pom.xml
- name: Publish Maven artifacts
run: |
# TODO: Fix test issue due to missing JSS shared libraries.
mvn \
--batch-mode \
--update-snapshots \
-DskipTests \
deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
wait-for-images:
name: Waiting for container images
needs: init
runs-on: ubuntu-latest
steps:
- name: Wait for container images
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'Building PKI'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
publish-images:
name: Publishing container images
needs: [init, wait-for-images]
runs-on: ubuntu-latest
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: vars.REGISTRY == 'ghcr.io'
- name: Log in to other container registry
uses: docker/login-action@v2
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
if: vars.REGISTRY != 'ghcr.io'
- name: Retrieve PKI images
uses: actions/cache@v3
with:
key: pki-images-${{ github.sha }}
path: pki-images.tar
- name: Load PKI images
run: docker load --input pki-images.tar
- name: Publish pki-dist image
run: |
docker tag pki-dist ${{ vars.REGISTRY }}/$NAMESPACE/pki-dist:latest
docker push ${{ vars.REGISTRY }}/$NAMESPACE/pki-dist:latest
- name: Publish pki-server image
run: |
docker tag pki-server ${{ vars.REGISTRY }}/$NAMESPACE/pki-server:latest
docker push ${{ vars.REGISTRY }}/$NAMESPACE/pki-server:latest
- name: Publish pki-ca image
run: |
docker tag pki-ca ${{ vars.REGISTRY }}/$NAMESPACE/pki-ca:latest
docker push ${{ vars.REGISTRY }}/$NAMESPACE/pki-ca:latest