Skip to content

Commit 0049f66

Browse files
authored
CI for publishing windows (#21)
Co-authored-by: tanin <@tanin>
1 parent 59f3f3e commit 0049f66

File tree

6 files changed

+112
-12
lines changed

6 files changed

+112
-12
lines changed

.github/workflows/create-release-desktop.yml renamed to .github/workflows/create-release-mac.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: create-release-desktop
1+
name: create-release-mac
22

33
on:
44
push:
@@ -107,7 +107,7 @@ jobs:
107107
with:
108108
draft: true
109109
prerelease: true
110-
files: ./build/jpackage/*.dmg
110+
files: ./build/dmg/*.dmg
111111
overwrite_files: true
112112
fail_on_unmatched_files: true
113113
generate_release_notes: true
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: create-release-mac
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Optional tag (starts with `v`). Default to the tag of the selected branch.'
11+
required: false
12+
type: string
13+
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
build:
20+
runs-on: windows-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
27+
- uses: actions/setup-java@v4
28+
with:
29+
distribution: temurin
30+
java-version: '21'
31+
cache: 'gradle'
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: '22'
35+
- name: Setup Gradle
36+
uses: gradle/actions/setup-gradle@v3
37+
with:
38+
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
39+
- name: Get version
40+
id: version
41+
run: echo "VERSION=$(./gradlew -q printInternalVersion)" >> "$GITHUB_OUTPUT"
42+
- name: Validate the tag name
43+
run: |
44+
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ ! -z "${{ github.event.inputs.tag }}" ]; then
45+
TAG=${{ github.event.inputs.tag }}
46+
else
47+
TAG=${GITHUB_REF#refs/tags/}
48+
fi
49+
if [[ ! "$TAG" =~ ^v ]]; then
50+
echo "Error: Tag ($TAG) must start with 'v'"
51+
exit 1
52+
fi
53+
if [[ ! $TAG == v${{ steps.version.outputs.VERSION }} ]]; then
54+
echo "Error: Git tag version ($TAG) doesn't match project version (v${{ steps.version.outputs.VERSION }})"
55+
exit 1
56+
fi
57+
- name: Install Node modules
58+
run: npm install
59+
- name: Download CodeSignTool and extract
60+
run: |
61+
$ProgressPreference = 'SilentlyContinue'
62+
New-Item -ItemType Directory -Force -Path "./build-tools/codesign"
63+
Invoke-WebRequest -Uri "https://www.ssl.com/download/codesigntool-for-windows/" -OutFile "./build-tools/CodeSignTool.zip"
64+
Expand-Archive -Path "./build-tools/CodeSignTool.zip" -DestinationPath "./build-tools/codesign" -Force
65+
Remove-Item "./build-tools/CodeSignTool.zip"
66+
shell: pwsh
67+
- name: Download wixtool 3 and extract
68+
run: |
69+
$ProgressPreference = 'SilentlyContinue'
70+
New-Item -ItemType Directory -Force -Path "./build-tools/wixtool"
71+
Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" -OutFile "./build-tools/wix-binaries.zip"
72+
Expand-Archive -Path "./build-tools/wix-binaries.zip" -DestinationPath "./build-tools/wixtool" -Force
73+
Remove-Item "./build-tools/wix-binaries.zip"
74+
shell: pwsh
75+
- name: Build an MSI
76+
run: |
77+
export PATH="$PATH:$PWD/build-tools/wixtool"
78+
./gradlew clean jpackage
79+
env:
80+
CODESIGN_TOOL_DIR: "./build-tools/codesign"
81+
SSL_COM_USERNAME: ${{ secrets.SSL_COM_USERNAME }}
82+
SSL_COM_PASSWORD: ${{ secrets.SSL_COM_PASSWORD }}
83+
SSL_COM_TOTP_SECRET: ${{ secrets.SSL_COM_TOTP_SECRET }}
84+
- name: Upload Release Asset
85+
uses: softprops/action-gh-release@v2
86+
with:
87+
draft: true
88+
prerelease: true
89+
files: ./build/msi/*.msi
90+
overwrite_files: true
91+
fail_on_unmatched_files: true
92+
generate_release_notes: true
93+
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}

.github/workflows/publish-desktop-testflight.yml renamed to .github/workflows/publish-mac-testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: publish-desktop-testflight
1+
name: publish-mac-testflight
22

33
on:
44
workflow_dispatch:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ build
1313
jdk
1414
hs_err_*.log
1515
/secret
16+
/build-tools

build.gradle.kts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,21 @@ tasks.register("jpackageForWindows") {
607607
outputAppDir.mkdirs()
608608

609609
runCmd(
610-
File("c:\\Users\\tanin\\projects\\CodeSignTool-v1.3.2-windows"),
611-
"CodeSignTool.bat",
612-
"sign",
613-
"-input_file_path=${inputs.files.singleFile.absolutePath}",
614-
"-output_dir_path=${outputAppDir.absolutePath}",
615-
"-program_name=JavaElectron",
616-
"-username=${System.getenv("SSL_COM_USERNAME")}",
617-
"-password=${System.getenv("SSL_COM_PASSWORD")}",
618-
"-totp_secret=${System.getenv("SSL_COM_TOTP_SECRET")}"
610+
File(System.getenv("CODESIGN_TOOL_DIR")),
611+
"bash",
612+
"-c",
613+
listOf(
614+
"CodeSignTool.bat",
615+
"sign",
616+
"-input_file_path=${inputs.files.singleFile.absolutePath}",
617+
"-output_dir_path=${outputAppDir.absolutePath}",
618+
"-program_name=Backdoor",
619+
$$"-username=$SSL_COM_USERNAME",
620+
$$"-password=$SSL_COM_PASSWORD",
621+
$$"-totp_secret=$SSL_COM_TOTP_SECRET",
622+
)
623+
.joinToString(" ")
624+
.replace("\\", "/")
619625
)
620626
}
621627
}
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)