8
8
branches : [ "development", "main", "release" ]
9
9
10
10
permissions :
11
- contents : write
11
+ contents : read
12
12
13
13
env :
14
14
VCPKG_ROOT : ${{ github.workspace }}/vcpkg
23
23
build :
24
24
name : CMake-Multi-Platform-Build
25
25
runs-on : ${{ matrix.os }}
26
+ permissions :
27
+ contents : write
26
28
27
29
strategy :
28
30
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
@@ -49,14 +51,14 @@ jobs:
49
51
steps :
50
52
51
53
- name : Checkout Repository
52
- uses : actions/checkout@v3
54
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
53
55
54
56
# add problem matchers by compiler
55
57
- name : Add Problem Matchers
56
- uses : ammaraskar/msvc-problem-matcher@master
58
+ uses : ammaraskar/msvc-problem-matcher@13149ebc00eaa00eadcd81b204d7159cca5de4fd # master
57
59
if : matrix.os == 'windows-2022'
58
60
- name : Add Problem Matchers
59
- uses : ammaraskar/gcc-problem-matcher@master
61
+ uses : ammaraskar/gcc-problem-matcher@d1fed1fac9e94d30e23b5a82dba4e2963e71d2e7 # master
60
62
if : matrix.os != 'windows-2022'
61
63
62
64
- name : Install vcpkg Dependencies
@@ -76,12 +78,12 @@ jobs:
76
78
if : matrix.os != 'windows-2022'
77
79
78
80
- name : Install Ninja
79
- uses : seanmiddleditch/gha-setup-ninja@master
81
+ uses : seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
80
82
if : matrix.os != 'windows-2022'
81
83
82
84
# Export vcpkg Cache Variables
83
85
- name : Export vcpkg Cache Variables
84
- uses : actions/github-script@v6
86
+ uses : actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
85
87
with :
86
88
script : |
87
89
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
@@ -100,7 +102,7 @@ jobs:
100
102
# os == windows-2022
101
103
#
102
104
- name : Setup VC Tools
103
- uses : ilammy/msvc-dev-cmd@v1
105
+ uses : ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
104
106
if : matrix.os == 'windows-2022'
105
107
106
108
- name : Patch vcpkg
@@ -174,12 +176,16 @@ jobs:
174
176
Compress-Archive -Path "${{env.ARTIFACTS_DIR_WIN}}\*.dll","${{env.ARTIFACTS_DIR_WIN}}\*.exe" -DestinationPath "${{env.ARTIFACTS_DIR_WIN}}\artifacts-${{matrix.os}}.zip" -Verbose -Force
175
177
176
178
- name : Upload Artifacts
177
- uses : actions/upload-artifact@v2
179
+ uses : actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
178
180
with :
179
181
name : ${{ matrix.os }}-artifacts
180
182
path : ${{ env.ARTIFACTS_DIR }}/artifacts-${{matrix.os}}.zip
181
183
retention-days : 1
182
184
185
+ #
186
+ # Create Release job
187
+ #
188
+
183
189
release :
184
190
# only on pushes to the release branch
185
191
name : Create Release
@@ -192,13 +198,40 @@ jobs:
192
198
steps :
193
199
194
200
- name : Checkout Repository
195
- uses : actions/checkout@v3
201
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
196
202
197
203
# download the artifacts
198
204
- name : " Download artifacts"
199
- uses : " actions/download-artifact@v2 "
205
+ uses : " actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a " # v3.0.2
200
206
with :
201
- path : ${{ github.workspace }}/artifacts
207
+ path : ${{ github.workspace }}/artifacts
208
+
209
+ - name : Rename Artifacts
210
+ run : |
211
+ mv ${{ github.workspace }}/artifacts/ubuntu-22.04-artifacts/artifacts-ubuntu-22.04.zip ${{ github.workspace }}/artifacts/OdbDesign-Linux-x64.zip
212
+ mv ${{ github.workspace }}/artifacts/windows-2022-artifacts/artifacts-windows-2022.zip ${{ github.workspace }}/artifacts/OdbDesign-Windows-x64.zip
213
+ mv ${{ github.workspace }}/artifacts/macos-12-artifacts/artifacts-macos-12.zip ${{ github.workspace }}/artifacts/OdbDesign-MacOS-x64.zip
214
+
215
+ - name : Generate SHA256 Sums
216
+ run : |
217
+ # sha256
218
+ cd ${{ github.workspace }}/artifacts
219
+ sha256sum OdbDesign-Linux-x64.zip > OdbDesign-Linux-x64.zip.sha256sum
220
+ sha256sum OdbDesign-Windows-x64.zip > OdbDesign-Windows-x64.zip.sha256sum
221
+ sha256sum OdbDesign-MacOS-x64.zip > OdbDesign-MacOS-x64.zip.sha256sum
222
+
223
+ - name : Import GPG Key
224
+ uses : crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
225
+ with :
226
+ gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
227
+ passphrase : ${{ secrets.PASSPHRASE }}
228
+
229
+ - name : Sign Binaries
230
+ run : |
231
+ cd ${{ github.workspace }}/artifacts
232
+ gpg --batch --yes --detach-sign --armor OdbDesign-Linux-x64.zip
233
+ gpg --batch --yes --detach-sign --armor OdbDesign-Windows-x64.zip
234
+ gpg --batch --yes --detach-sign --armor OdbDesign-MacOS-x64.zip
202
235
203
236
- name : Create Release Variables
204
237
run : |
@@ -209,50 +242,52 @@ jobs:
209
242
export RELEASE_NAME="OdbDesign ${RELEASE_TAG}"
210
243
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
211
244
212
- - name : Rename Artifacts
213
- run : |
214
- mv ${{ github.workspace }}/artifacts/ubuntu-22.04-artifacts/artifacts-ubuntu-22.04.zip ${{ github.workspace }}/artifacts/OdbDesign-Linux-x64.zip
215
- mv ${{ github.workspace }}/artifacts/windows-2022-artifacts/artifacts-windows-2022.zip ${{ github.workspace }}/artifacts/OdbDesign-Windows-x64.zip
216
- mv ${{ github.workspace }}/artifacts/macos-12-artifacts/artifacts-macos-12.zip ${{ github.workspace }}/artifacts/OdbDesign-MacOS-x64.zip
217
-
218
245
# create a release
219
246
- name : " Create GitHub Release"
220
- uses : " actions/github-script@v6 "
247
+ uses : " actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 " # v6.4.1
221
248
with :
222
249
github-token : " ${{ secrets.GITHUB_TOKEN }}"
223
250
script : |
224
- try {
225
- const createResponse = await github.rest.repos.createRelease({
226
- generate_release_notes: true,
227
- name: process.env.RELEASE_NAME,
228
- owner: context.repo.owner,
229
- repo: context.repo.repo,
230
- tag_name: process.env.RELEASE_TAG,
231
- body: require('fs').readFileSync('${{ github.workspace }}/release/release-body.md', 'utf8'),
232
- target_commitish: '${{ github.ref_name }}'
251
+ try {
252
+ const createResponse = await github.rest.repos.createRelease({
253
+ generate_release_notes: true,
254
+ name: process.env.RELEASE_NAME,
255
+ owner: context.repo.owner,
256
+ repo: context.repo.repo,
257
+ tag_name: process.env.RELEASE_TAG,
258
+ body: require('fs').readFileSync('${{ github.workspace }}/release/release-body.md', 'utf8'),
259
+ target_commitish: '${{ github.ref_name }}'
233
260
});
234
261
235
- const filenames = [
236
- 'OdbDesign-Linux-x64.zip',
237
- 'OdbDesign-Windows-x64.zip',
238
- 'OdbDesign-MacOS-x64.zip'
262
+ const files =
263
+ [
264
+ { name: 'OdbDesign-Linux-x64.zip', contentType: 'application/zip' },
265
+ { name: 'OdbDesign-Linux-x64.zip.sha256sum', contentType: 'text/plain' },
266
+ { name: 'OdbDesign-Linux-x64.zip.asc', contentType: 'text/plain' },
267
+ { name: 'OdbDesign-Windows-x64.zip', contentType: 'application/zip' },
268
+ { name: 'OdbDesign-Windows-x64.zip.sha256sum', contentType: 'text/plain' },
269
+ { name: 'OdbDesign-Windows-x64.zip.asc', contentType: 'text/plain' },
270
+ { name: 'OdbDesign-MacOS-x64.zip', contentType: 'application/zip' },
271
+ { name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' },
272
+ { name: 'OdbDesign-MacOS-x64.zip.asc', contentType: 'text/plain' }
239
273
];
274
+
275
+ const artifactsPath = '${{ github.workspace }}/artifacts';
240
276
241
- for (const filename of filenames) {
242
- const artifactsPath = '${{ github.workspace }}/artifacts';
243
- const filePath = artifactsPath +'/' + filename;
277
+ for (const file of files) {
278
+ const filePath = artifactsPath +'/' + file.name;
244
279
const uploadResponse = await github.rest.repos.uploadReleaseAsset({
245
280
owner: context.repo.owner,
246
281
repo: context.repo.repo,
247
282
release_id: createResponse.data.id,
248
- name: filename ,
283
+ name: file.name ,
249
284
data: require('fs').readFileSync(filePath),
250
285
headers: {
251
- 'content-type': 'application/zip' ,
252
- 'content-length': require('fs').statSync(filePath).size
286
+ 'content-type': file.contentType ,
287
+ 'content-length': require('fs').statSync(filePath).size
253
288
}
254
289
});
255
290
}
256
291
} catch (error) {
257
292
core.setFailed(error.message);
258
- }
293
+ }
0 commit comments