-
Notifications
You must be signed in to change notification settings - Fork 1
221 lines (202 loc) · 8.42 KB
/
release.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
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
215
216
217
218
219
220
221
name: "Analysis with SonarCloud and package for Windows, Linux, MacOS"
on:
push:
branches: [ "main" ]
permissions: # added using https://github.com/step-security/secure-repo
contents: read
jobs:
package_for_linux:
name: Package for Linux and Analyze with SonarCloud
runs-on: ubuntu-latest
environment: production
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
distribution: 'temurin'
java-version: '21'
check-latest: true
cache: 'maven'
- name: Verify Java Installation
run: java -version
- name: Install Xvfb
run: sudo apt-get install -y xvfb
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1920x1080x24 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Compile, Test, Package, and analyze with Maven profile (Linux)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B package -P linux -f pom.xml org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=Lob2018_SudoFX2024 -Dsonar.qualitygate.wait=true -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
- name: Upload output folder (Linux)
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: output-folder-linux
path: output
package_for_windows:
name: Package for Windows
needs: [ package_for_linux ]
runs-on: windows-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
distribution: 'temurin'
java-version: '21'
check-latest: true
cache: 'maven'
- name: Verify Java Installation
run: java -version
shell: cmd
- name: Cache WiX Toolset
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: wix311.exe
key: ${{ runner.os }}-wix311
- name: Install WiX Toolset
run: |
if (!(Test-Path wix311.exe)) {
Write-Host "wix311.exe is downloaded."
$url = 'https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311.exe'
$output = 'wix311.exe'
Invoke-WebRequest -Uri $url -OutFile $output
Start-Process -FilePath $output -ArgumentList '/quiet' -Wait -NoNewWindow
} else {
Write-Host "wix311.exe is in the cache."
}
- name: Add WiX Toolset to PATH
run: |
$newPath = 'C:\Program Files (x86)\WiX Toolset v3.11\bin'
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'Machine')
[Environment]::SetEnvironmentVariable('PATH', "$newPath;$currentPath", 'Machine')
- name: Compile, Test, and Package with Maven
run: mvn package -f pom.xml
- name: Upload output folder
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: output-folder-windows
path: output
package_for_macos:
name: Package for MacOS
needs: [ package_for_linux ]
runs-on: macos-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
distribution: 'temurin'
java-version: '21'
check-latest: true
cache: 'maven'
- name: Verify Java Installation
run: java -version
- name: Install Xvfb
run: brew install XQuartz
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1920x1080x24 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Compile, Test, and Package with Maven (macOS)
run: mvn package -P mac -f pom.xml
- name: Upload output folder (macOS)
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: output-folder-macos
path: output
package_for_macos_x86_64:
name: Package for MacOS x86_64
needs: [ package_for_linux ]
runs-on: macos-13
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
distribution: 'temurin'
java-version: '21'
check-latest: true
cache: 'maven'
- name: Verify Java Installation
run: java -version
- name: Install Xvfb
run: brew install XQuartz
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1920x1080x24 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Compile, Test, and Package with Maven (macOS)
run: mvn package -P mac-x86_64 -f pom.xml
- name: Upload output folder (macOS-x86_64)
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: output-folder-macos-x86_64
path: output
publish_release:
permissions:
contents: write # for ncipollo/release-action to create a release
name: Publish the release and tag it
needs: [ package_for_windows, package_for_linux, package_for_macos, package_for_macos_x86_64 ]
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Extract version
run: echo "POM_VERSION=$(cat pom.xml | grep -oPm1 '(?<=<version>)[^<]+')" >> $GITHUB_ENV
- name: Download output folder (Windows)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: output-folder-windows
path: output
- name: Download output folder (Linux)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: output-folder-linux
path: output
- name: Download output folder (MacOS)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: output-folder-macos
path: output
- name: Download output folder (MacOS-x86_64)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: output-folder-macos-x86_64
path: output
- name: Create Release
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0
with:
name: SudokuFX release v${{ env.POM_VERSION }}
tag: v${{ env.POM_VERSION }}
body: <br>▪ The compressed files for Windows MacOS (ZIP) and Linux (TAR) do not include the Java Runtime Environment (the latest JRE must be installed on your machine), the .bat file (for Windows) and the .sh file (for Linux and MacOS) launch the application.<br><br>▪ Both the MSI .dmg and .deb files include the Java Runtime Environment and install the application on your machine.<br><br>▪ The hash_windows.txt file, the hash_linux.txt file, and the hash_macos.txt file, contain the files fingerprints.
artifacts: 'output/*'
- name: Create Tag
run: git tag v${{ env.POM_VERSION }}
- name: Push Tag
run: git push --tags