-
Notifications
You must be signed in to change notification settings - Fork 20
214 lines (182 loc) · 6.8 KB
/
package.yaml
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Package
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
linux-deb:
environment: packaging
runs-on: ubuntu-latest
container: "debian:latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup dependencies
run: |
apt-get -q update && apt-get -q upgrade -y
apt-get -q install -y openjdk-17-jdk maven binutils fakeroot wget git
- uses: actions/checkout@v4
- name: Build artifact
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
./mvnw versions:set -DnewVersion=$(git describe --tags --abbrev=0 | sed -r 's/^v//g')
./mvnw -B -C -V package
ls -lah ./target
- name: Create release if tag pushed
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: true
files: |
target/*.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux-rpm:
environment: packaging
runs-on: ubuntu-latest
container: "fedora:latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup dependencies
run: |
dnf -q install -y java-17-openjdk maven rpm-build git
- uses: actions/checkout@v4
- name: Build artifact
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
./mvnw versions:set -DnewVersion=$(git describe --tags --abbrev=0 | sed -r 's/^v//g')
./mvnw -B -C -V package
ls -lah ./target
- name: Create release if tag pushed
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: true
files: |
target/*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos:
environment: packaging
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: target
- name: Update version in pom if tag pushed
if: startsWith(github.ref, 'refs/tags/')
run: ./mvnw versions:set -DnewVersion=$(git describe --tags --abbrev=0 | sed -r 's/^v//g')
shell: bash
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: "17.0.7+7"
- name: Cache local Maven repository and JDK cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
target/jdkCache
key: macos-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
macos-maven-
- name: Install an Apple keychain (MacOS)
# based on https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development#add-a-step-to-your-workflow
env:
APPLE_KEYCHAIN_BASE64: ${{ secrets.APPLE_KEYCHAIN_BASE64 }}
APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
APPLE_DEVELOPER_IDENTITY: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
shell: bash
run: |
# create variables
APPLE_KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# share to rest of steps
echo "APPLE_KEYCHAIN_PATH=$APPLE_KEYCHAIN_PATH" >> "$GITHUB_ENV"
# import keychain from secrets
echo -n "$APPLE_KEYCHAIN_BASE64" | base64 --decode -o $APPLE_KEYCHAIN_PATH
set -x
# unlock, set timeout and set as used keychain
security unlock-keychain -p "$APPLE_KEYCHAIN_PASSWORD" $APPLE_KEYCHAIN_PATH
#security set-keychain-settings -lut 21600 $APPLE_KEYCHAIN_PATH
security list-keychain -d user -s $APPLE_KEYCHAIN_PATH
security default-keychain -s $APPLE_KEYCHAIN_PATH
- name: Package with Maven
run: ./mvnw -B -C -V package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_KEYCHAIN_PATH: ${{ env.APPLE_KEYCHAIN_PATH }}
APPLE_DEVELOPER_IDENTITY: ${{ secrets.APPLE_DEVELOPER_IDENTITY }}
- name: Notarize release with Apple (MacOS)
env:
APPLE_KEYCHAIN_PATH: ${{ env.APPLE_KEYCHAIN_PATH }}
shell: bash
run: |
set -x
# run notarization
xcrun notarytool submit --keychain-profile "autogram" --keychain $APPLE_KEYCHAIN_PATH --wait target/Autogram-*.pkg
# staple
xcrun stapler staple target/Autogram-*.pkg
# lock all keychains
security lock-keychain -a
- name: Create release if tag pushed
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: true
files: |
target/*.pkg
target/*.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows:
environment: packaging
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: target
- name: Update version in pom if tag pushed
if: startsWith(github.ref, 'refs/tags/')
run: ./mvnw versions:set -DnewVersion=$(git describe --tags --abbrev=0 | sed -r 's/^v//g')
shell: bash
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: "17.0.7+7"
- name: Cache local Maven repository and JDK cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
target/jdkCache
key: windows-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
windows-maven-
- name: Package with Maven
run: ./mvnw -B -C -V package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sign on Azure
shell: bash
run: |
dotnet tool install --global AzureSignTool
AzureSignTool sign --description "Autogram" -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v target/*.msi
- name: Create release if tag pushed
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: true
files: |
target/*.exe
target/*.msi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}