Skip to content

Commit c01f75f

Browse files
committed
feat: Windows Signing
1 parent e7eec56 commit c01f75f

5 files changed

Lines changed: 76 additions & 9 deletions

File tree

.github/workflows/publish.yml

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- main
10+
- windowsSigning
1011

1112
jobs:
1213
build-and-publish:
@@ -49,11 +50,77 @@ 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
5469
env:
5570
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
run: npm exec electron-builder -- --publish --win
71+
72+
- name: Build Windows executable (no publish)
73+
if: matrix.platform == 'win'
74+
run: npm exec electron-builder -- --win --publish=never
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: cobolt-unsigned-installer
84+
retention-days: 1
85+
path: |
86+
release/build/Cobolt-Setup-${{ steps.get-version.outputs.version }}.exe
87+
release/build/Cobolt-Setup-${{ steps.get-version.outputs.version }}.exe.blockmap
88+
89+
- name: Sign artifact
90+
if: matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0'
91+
uses: signpath/github-action-submit-signing-request@v1.1
92+
with:
93+
api-token: ${{secrets.SIGNPATH_API_TOKEN}}
94+
organization-id: 3fe5dc9d-e6f6-4c25-83e5-70c5844441b9
95+
project-slug: cobolt
96+
signing-policy-slug: test-signing
97+
github-artifact-id: ${{steps.upload-unsigned-artifact.outputs.artifact-id}}
98+
wait-for-completion: true
99+
output-artifact-directory: signed-artifacts
100+
101+
- name: Update latest.yml with signed artifact details
102+
if: matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0'
103+
shell: bash
104+
run: |
105+
# Get the size of the signed executable
106+
SIGNED_SIZE=$(stat -c%s "signed-artifacts/${{ steps.get-version.outputs.artifact-name }}")
107+
108+
# Update latest.yml to point to signed artifacts
109+
if [ -f "release/build/latest.yml" ]; then
110+
# Update the file reference and size in latest.yml
111+
sed -i "s|size: [0-9]*|size: $SIGNED_SIZE|g" release/build/latest.yml
112+
113+
# Copy updated latest.yml to signed-artifacts directory
114+
cp release/build/latest.yml signed-artifacts/
115+
fi
116+
117+
- name: Publish Windows release with signed executable
118+
if: matrix.platform == 'win' && steps.check-release.outputs.release-exists == '0'
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
run: |
122+
# Create or update release with signed executable
123+
gh release create "v${{ steps.get-version.outputs.version }}" signed-artifacts/${{ steps.get-version.outputs.artifact-name }} signed-artifacts/${{ steps.get-version.outputs.artifact-name }}.blockmap signed-artifacts/latest.yml --title "v${{ steps.get-version.outputs.version }}" --notes "Release v${{ steps.get-version.outputs.version }}" --draft || (gh release upload "v${{ steps.get-version.outputs.version }}" signed-artifacts/${{ steps.get-version.outputs.artifact-name }} --clobber && gh release upload "v${{ steps.get-version.outputs.version }}" signed-artifacts/${{ steps.get-version.outputs.artifact-name }}.blockmap --clobber && gh release upload "v${{ steps.get-version.outputs.version }}" signed-artifacts/latest.yml --clobber)
57124
58125
- name: Publish macOS release
59126
if: matrix.platform == 'mac'
@@ -70,4 +137,4 @@ jobs:
70137
if: matrix.platform == 'linux'
71138
env:
72139
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
run: npm exec electron-builder -- --publish always --linux
140+
run: npm exec electron-builder -- --publish always --linux

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cobolt",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Your personal AI companion",
55
"keywords": [],
66
"repository": {

release/app/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cobolt",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Cobolt",
55
"license": "MIT",
66
"author": {

0 commit comments

Comments
 (0)