Skip to content

Commit ca00d29

Browse files
author
tanin
committed
CI for publishing windows
1 parent 0049f66 commit ca00d29

File tree

6 files changed

+51
-37
lines changed

6 files changed

+51
-37
lines changed

.github/workflows/create-release-mac.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v4
25-
with:
26-
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
2725
- name: Import Signing Certificate
2826
run: |
2927
# Create a temporary keychain

.github/workflows/create-release-windows.yml

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

33
on:
44
push:
@@ -18,66 +18,79 @@ permissions:
1818
jobs:
1919
build:
2020
runs-on: windows-latest
21+
defaults:
22+
run:
23+
shell: msys2 {0}
2124

2225
steps:
26+
- uses: msys2/setup-msys2@v2
27+
with:
28+
update: true
29+
install: >-
30+
curl
31+
git
32+
gcc
33+
unzip
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: '22'
2337
- name: Checkout
2438
uses: actions/checkout@v4
25-
with:
26-
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
39+
- name: Install Node modules
40+
run: |
41+
export PATH="${PATH}:/c/hostedtoolcache/windows/node/22.21.1/x64"
42+
npm install
2743
- uses: actions/setup-java@v4
2844
with:
2945
distribution: temurin
3046
java-version: '21'
3147
cache: 'gradle'
32-
- uses: actions/setup-node@v4
33-
with:
34-
node-version: '22'
3548
- name: Setup Gradle
3649
uses: gradle/actions/setup-gradle@v3
3750
with:
3851
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
3952
- name: Get version
4053
id: version
41-
run: echo "VERSION=$(./gradlew -q printInternalVersion)" >> "$GITHUB_OUTPUT"
54+
run: |
55+
version=$(./gradlew -q printInternalVersion)
56+
echo "VERSION=$version" >> $GITHUB_OUTPUT
4257
- name: Validate the tag name
4358
run: |
44-
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ ! -z "${{ github.event.inputs.tag }}" ]; then
59+
if [[ "${{ github.event_name }}" == "workflow_dispatch" && ! -z "${{ github.event.inputs.tag }}" ]]; then
4560
TAG=${{ github.event.inputs.tag }}
4661
else
4762
TAG=${GITHUB_REF#refs/tags/}
4863
fi
4964
if [[ ! "$TAG" =~ ^v ]]; then
5065
echo "Error: Tag ($TAG) must start with 'v'"
5166
exit 1
52-
fi
67+
fi
5368
if [[ ! $TAG == v${{ steps.version.outputs.VERSION }} ]]; then
5469
echo "Error: Git tag version ($TAG) doesn't match project version (v${{ steps.version.outputs.VERSION }})"
5570
exit 1
5671
fi
57-
- name: Install Node modules
58-
run: npm install
5972
- name: Download CodeSignTool and extract
6073
run: |
6174
$ProgressPreference = 'SilentlyContinue'
6275
New-Item -ItemType Directory -Force -Path "./build-tools/codesign"
6376
Invoke-WebRequest -Uri "https://www.ssl.com/download/codesigntool-for-windows/" -OutFile "./build-tools/CodeSignTool.zip"
6477
Expand-Archive -Path "./build-tools/CodeSignTool.zip" -DestinationPath "./build-tools/codesign" -Force
6578
Remove-Item "./build-tools/CodeSignTool.zip"
66-
shell: pwsh
79+
shell: powershell
6780
- name: Download wixtool 3 and extract
6881
run: |
6982
$ProgressPreference = 'SilentlyContinue'
7083
New-Item -ItemType Directory -Force -Path "./build-tools/wixtool"
7184
Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" -OutFile "./build-tools/wix-binaries.zip"
7285
Expand-Archive -Path "./build-tools/wix-binaries.zip" -DestinationPath "./build-tools/wixtool" -Force
7386
Remove-Item "./build-tools/wix-binaries.zip"
74-
shell: pwsh
87+
shell: powershell
7588
- name: Build an MSI
7689
run: |
77-
export PATH="$PATH:$PWD/build-tools/wixtool"
90+
export PATH="${PATH}:$PWD/build-tools/wixtool:/c/hostedtoolcache/windows/node/22.21.1/x64"
91+
export CODESIGN_TOOL_DIR="$PWD/build-tools/codesign"
7892
./gradlew clean jpackage
7993
env:
80-
CODESIGN_TOOL_DIR: "./build-tools/codesign"
8194
SSL_COM_USERNAME: ${{ secrets.SSL_COM_USERNAME }}
8295
SSL_COM_PASSWORD: ${{ secrets.SSL_COM_PASSWORD }}
8396
SSL_COM_TOTP_SECRET: ${{ secrets.SSL_COM_TOTP_SECRET }}

.github/workflows/publish-mac-testflight.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jobs:
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
22-
with:
23-
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
2422
- name: Import Signing Certificate
2523
run: |
2624
# Create a temporary keychain

build.gradle.kts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2+
import org.gradle.internal.extensions.stdlib.toDefaultLowerCase
23
import java.nio.file.Files
34
import java.nio.file.Paths
4-
import java.util.Locale
55
import kotlin.io.path.absolutePathString
66
import kotlin.io.path.createTempDirectory
77
import kotlin.io.path.isExecutable
@@ -256,8 +256,19 @@ tasks.register("copyJar", Copy::class) {
256256
from(tasks.jar).into(layout.buildDirectory.dir("jmods"))
257257
}
258258

259+
private fun maskSecret(args: Array<out String>): List<String> {
260+
return args.map { arg ->
261+
val sanitized = arg.toDefaultLowerCase()
262+
if (sanitized.contains("password") || sanitized.contains("secret")) {
263+
"<REDACTED>"
264+
} else {
265+
arg
266+
}
267+
}
268+
}
269+
259270
private fun runCmd(currentDir: File, vararg args: String): String {
260-
println("Executing command: ${args.joinToString(" ")}")
271+
println("Executing command: ${maskSecret(args).joinToString(" ")} at ${currentDir.absolutePath}")
261272

262273
val output = StringBuilder()
263274
val process = ProcessBuilder(*args)
@@ -607,21 +618,15 @@ tasks.register("jpackageForWindows") {
607618
outputAppDir.mkdirs()
608619

609620
runCmd(
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("\\", "/")
621+
File(System.getenv("CODESIGN_TOOL_DIR")).canonicalFile,
622+
"CodeSignTool.bat",
623+
"sign",
624+
"-input_file_path=${inputs.files.singleFile.absolutePath}",
625+
"-output_dir_path=${outputAppDir.absolutePath}",
626+
"-program_name=Backdoor",
627+
"-username=${System.getenv("SSL_COM_USERNAME")}",
628+
"-password=${System.getenv("SSL_COM_PASSWORD")}",
629+
"-totp_secret=${System.getenv("SSL_COM_TOTP_SECRET")}",
625630
)
626631
}
627632
}

src/main/c/WindowsApi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ __declspec(dllexport) char* openFileDialog(long hwnd, bool isSaved) {
1717

1818
ZeroMemory(&ofn, sizeof(ofn));
1919
ofn.lStructSize = sizeof(ofn);
20-
ofn.hwndOwner = (HWND) (uintptr_t) hwnd;
20+
ofn.hwndOwner = (HWND) (size_t) hwnd;
2121
ofn.lpstrFile = szFile;
2222
ofn.lpstrFile[0] = '\0';
2323
ofn.nMaxFile = sizeof(szFile);
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)