-
Notifications
You must be signed in to change notification settings - Fork 8
159 lines (144 loc) · 5.64 KB
/
deploy.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Deploy
on:
push:
tags:
- "*"
jobs:
deployment:
permissions:
packages: write
environment: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
server-id: openconext-releases
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Set up cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Extract Maven project version
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
id: project
- name: Check if git tag matches project version
run: |
echo "Project version ${{ steps.project.outputs.version }} does not match git tag ${{ github.ref_name }}"
exit 1
if: ${{ steps.project.outputs.version != github.ref_name }}
- name: Deploy with Maven
run: mvn --batch-mode deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.BUILD_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.BUILD_PASSWORD }}
- name: Build Changelog
id: changelog
uses: ardalanamini/auto-changelog@v3
with:
default-commit-type: New Features
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: Release ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body: |
${{ steps.changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Check account-gui zip existence
id: check_file_account_gui
uses: andstor/file-existence-action@v1
with:
files: "/home/runner/work/OpenConext-myconext/OpenConext-myconext/account-gui/target/account-gui-${{ github.ref_name }}.zip"
- name: Upload account-gui zip to github release
if: steps.check_file_account_gui.outputs.files_exists == 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "/home/runner/work/OpenConext-myconext/OpenConext-myconext/account-gui/target/account-gui-${{ github.ref_name }}.zip"
asset_name: account-gui-${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Check myconext-gui zip existence
id: check_file_myconext_gui
uses: andstor/file-existence-action@v1
with:
files: "/home/runner/work/OpenConext-myconext/OpenConext-myconext/myconext-gui/target/myconext-gui-${{ github.ref_name }}.zip"
- name: Upload myconext-gui zip to github release
if: steps.check_file_myconext_gui.outputs.files_exists == 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/OpenConext-myconext/OpenConext-myconext/myconext-gui/target/myconext-gui-${{ github.ref_name }}.zip
asset_name: myconext-gui-${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Check myconext-server jar existence
id: check_file_myconext_server
uses: andstor/file-existence-action@v1
with:
files: "/home/runner/work/OpenConext-myconext/OpenConext-myconext/myconext-server/target/myconext-server-${{ github.ref_name }}.jar"
- name: Upload myconext-server jar to github release
if: steps.check_file_myconext_server.outputs.files_exists == 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/OpenConext-myconext/OpenConext-myconext/myconext-server/target/myconext-server-${{ github.ref_name }}.jar
asset_name: myconext-server-${{ github.ref_name }}.jar
asset_content_type: application/zip
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the account gui image
uses: docker/build-push-action@v4
with:
context: account-gui
file: account-gui/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-myconext/account-gui:${{ github.ref_name }}
- name: Build and push the myconext gui image
uses: docker/build-push-action@v4
with:
context: myconext-gui
file: myconext-gui/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-myconext/myconext-gui:${{ github.ref_name }}
- name: Build and push the server image
uses: docker/build-push-action@v4
with:
context: myconext-server
file: myconext-server/docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-myconext/myconext-server:${{ github.ref_name }}