forked from NUWCDIVNPT/stigman-watcher
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (69 loc) · 2.4 KB
/
build-binary-artifacts.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
name: Build and Sign Binary Artifacts
on:
release:
types: [published]
workflow_dispatch:
push:
branches:
- main
- build-workflow-pr
paths:
- "lib/**"
- "index.js"
- "build.sh"
- "nuwcdivnpt-bot.gpg.asc"
- ".github/workflows/build-binary-artifacts.yml"
jobs:
build-binary-artifacts-and-sign:
name: Build binary artifacts, sign, export
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
ref: build-workflow-pr
fetch-depth: 0
- name: Import GPG Key
id: import_gpg
run: |
if ! echo "${{ secrets.WATCHER_PRIVATE_KEY }}" | gpg --import; then
echo "::warning ::Private key GPG Import failed"
exit 1
fi
- name: run build script
id: run_build_script
run: ./build.sh
- name: Get version from package.json
id: package_version
run: echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
- name: Sign Artifacts
id: sign_artifacts
run: |
if ! gpg--default-key [email protected] --armor --detach-sig ./dist/stigman-watcher-linux-${{ env.PACKAGE_VERSION }}.tar.gz; then
echo "::warning ::Linux Signing failed"
exit 1
fi
if ! gpg--default-key [email protected] --armor --detach-sig ./dist/stigman-watcher-win-${{ env.PACKAGE_VERSION }}.zip; then
echo "::warning ::Windows Signing failed"
exit 1
fi
- name: Verify Signatures
id: verify_signatures
working-directory: ./dist
run: |
if ! gpg --verify stigman-watcher-linux-${{ env.PACKAGE_VERSION }}.tar.gz.asc stigman-watcher-linux-${{ env.PACKAGE_VERSION }}.tar.gz; then
echo "::warning ::Signature verification for Linux failed"
exit 1
fi
if ! gpg --verify stigman-watcher-win-${{ env.PACKAGE_VERSION }}.zip.asc stigman-watcher-win-${{ env.PACKAGE_VERSION }}.zip; then
echo "::warning ::Signature verification for Windows failed"
exit 1
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: binary-artifacts
path: |
./dist/
if-no-files-found: error