77 push :
88 branches :
99 - main
10+ - windowsSigning
1011
1112jobs :
1213 build-and-publish :
@@ -49,11 +50,59 @@ jobs:
4950 npm run postinstall
5051 npm run build
5152
52- - name : Publish Windows release
53+ - name : Get package version
5354 if : matrix.platform == 'win'
55+ id : get-version
56+ shell : bash
57+ run : |
58+ VERSION=$(node -p "require('./package.json').version")
59+ echo "version=$VERSION" >> $GITHUB_OUTPUT
60+ echo "artifact-name=Cobolt-Setup-$VERSION.exe" >> $GITHUB_OUTPUT
61+
62+ - name : Check if release already exists
63+ if : matrix.platform == 'win'
64+ id : check-release
65+ shell : bash
66+ run : |
67+ RELEASE_EXISTS=$(gh release view "v${{ steps.get-version.outputs.version }}" --json assets,draft --jq 'if .draft == false then .assets | map(select(.name == "${{ steps.get-version.outputs.artifact-name }}")) | length else 0 end' 2>/dev/null || echo "0")
68+ echo "release-exists=$RELEASE_EXISTS" >> $GITHUB_OUTPUT
69+ env :
70+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71+
72+ - name : Build Windows executable (no publish)
73+ if : matrix.platform == 'win'
74+ run : npm exec electron-builder -- --win --publish=never
5475 env :
5576 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56- run : npm exec electron-builder -- --publish --win
77+
78+ - name : upload-unsigned-artifact
79+ id : upload-unsigned-artifact
80+ if : matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0'
81+ uses : actions/upload-artifact@v4
82+ with :
83+ name : unsigned-installer
84+ retention-days : 1
85+ path : release/build/Cobolt-Setup-${{ steps.get-version.outputs.version }}.exe
86+
87+ - name : Sign artifact
88+ if : matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0'
89+ uses : signpath/github-action-submit-signing-request@v1.1
90+ with :
91+ api-token : ${{secrets.SIGNPATH_API_TOKEN}}
92+ organization-id : 3fe5dc9d-e6f6-4c25-83e5-70c5844441b9
93+ project-slug : cobolt
94+ signing-policy-slug : test-signing
95+ github-artifact-id : ${{steps.upload-unsigned-artifact.outputs.artifact-id}}
96+ wait-for-completion : true
97+ output-artifact-directory : signed-artifacts
98+
99+ - name : Publish Windows release with signed executable
100+ if : matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0'
101+ env :
102+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
103+ run : |
104+ # Create or update release with signed executable
105+ gh release create "v${{ steps.get-version.outputs.version }}" signed-artifacts/${{ steps.get-version.outputs.artifact-name }} --title "v${{ steps.get-version.outputs.version }}" --notes "Release v${{ steps.get-version.outputs.version }}" || gh release upload "v${{ steps.get-version.outputs.version }}" signed-artifacts/${{ steps.get-version.outputs.artifact-name }} --clobber
57106
58107 - name : Publish macOS release
59108 if : matrix.platform == 'mac'
70119 if : matrix.platform == 'linux'
71120 env :
72121 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
73- run : npm exec electron-builder -- --publish always --linux
122+ run : npm exec electron-builder -- --publish always --linux
0 commit comments