-
Notifications
You must be signed in to change notification settings - Fork 30
104 lines (90 loc) · 2.89 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
name: Publish JSS
on:
push:
branches:
- master
env:
NAMESPACE: ${{ vars.REGISTRY_NAMESPACE || github.repository_owner }}
jobs:
publish-maven:
if: vars.REGISTRY != ''
name: Publishing Maven artifacts
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install xmlstarlet
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Configure settings.xml
run: |
xmlstarlet edit --inplace \
-u "/_:settings/_:servers/_:server[_:id='github']/_:password" \
-v "$REPO_TOKEN" \
~/.m2/settings.xml
cat ~/.m2/settings.xml
env:
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
- name: Configure pom.xml
run: |
xmlstarlet edit --inplace \
-u "/_:project/_:build/_:plugins/_:plugin[_:artifactId='site-maven-plugin']/_:configuration/_:repositoryOwner" \
-v "$NAMESPACE" \
pom.xml
cat pom.xml
- name: Publish Maven artifacts
run: |
# TODO: Fix build issue in native and symkey modules.
mvn \
--batch-mode \
--update-snapshots \
-pl '!native,!symkey' \
deploy
wait-for-images:
if: vars.REGISTRY != ''
name: Waiting for container images
runs-on: ubuntu-latest
steps:
- name: Wait for container images
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'Building JSS'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
publish-images:
name: Publishing container images
needs: wait-for-images
runs-on: ubuntu-latest
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
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@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
if: vars.REGISTRY != 'ghcr.io'
- name: Retrieve JSS images
uses: actions/cache@v4
with:
key: jss-images-${{ github.sha }}
path: jss-images.tar
- name: Load JSS images
run: docker load --input jss-images.tar
- name: Publish jss-dist image
run: |
docker tag jss-dist ${{ vars.REGISTRY }}/$NAMESPACE/jss-dist:latest
docker push ${{ vars.REGISTRY }}/$NAMESPACE/jss-dist:latest