Skip to content

Commit 319cf41

Browse files
authored
Merge pull request #6 from moja-global/feature/installer-sync-2026-03-21
Feature/installer sync 2026 03 21
2 parents b98292e + e51bee2 commit 319cf41

2 files changed

Lines changed: 79 additions & 7 deletions

File tree

.github/workflows/windows-installer.yml

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Windows Installer
33
on:
44
workflow_dispatch:
55
push:
6+
branches:
7+
- main
68
tags:
79
- "v*"
810

@@ -67,6 +69,29 @@ jobs:
6769
path: cbm_defaults
6870
token: ${{ secrets.CROSS_REPO_READ_TOKEN }}
6971

72+
- name: Set installer metadata
73+
id: meta
74+
shell: pwsh
75+
run: |
76+
$sha = $env:GITHUB_SHA.Substring(0, 7)
77+
if ($env:GITHUB_REF -like 'refs/tags/v*') {
78+
$version = $env:GITHUB_REF_NAME.Substring(1)
79+
$channel = "release"
80+
} elseif ($env:GITHUB_REF -eq 'refs/heads/main') {
81+
$version = "0.0.$($env:GITHUB_RUN_NUMBER)"
82+
$channel = "continuous"
83+
} else {
84+
$version = "0.0.$($env:GITHUB_RUN_NUMBER)"
85+
$channel = "manual"
86+
}
87+
88+
"INSTALLER_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
89+
"INSTALLER_CHANNEL=$channel" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
90+
"INSTALLER_SHA=$sha" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
91+
92+
"installer_version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
93+
"installer_channel=$channel" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
94+
7095
- name: Setup Python 3.10
7196
uses: actions/setup-python@v5
7297
with:
@@ -99,17 +124,62 @@ jobs:
99124
shell: pwsh
100125
run: |
101126
& "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe" `
127+
"/DMyAppVersion=$env:INSTALLER_VERSION" `
102128
"$env:GITHUB_WORKSPACE\\gcbm_view\\installer\\gcbm_view_installer.iss"
103129
104130
- name: Upload installer artifact
105131
uses: actions/upload-artifact@v4
106132
with:
107-
name: gcbm-view-installer
133+
name: gcbm-view-installer-${{ env.INSTALLER_VERSION }}-${{ env.INSTALLER_SHA }}
108134
path: gcbm_view/installer/output/*.exe
109135
if-no-files-found: error
110136

111-
- name: Publish GitHub release asset
137+
- name: Publish versioned release asset
112138
if: startsWith(github.ref, 'refs/tags/')
113139
uses: softprops/action-gh-release@v2
114140
with:
141+
name: GCBM View v${{ env.INSTALLER_VERSION }}
142+
generate_release_notes: true
143+
files: gcbm_view/installer/output/*.exe
144+
overwrite_files: true
145+
146+
- name: Cleanup continuous release assets
147+
if: github.ref == 'refs/heads/main'
148+
uses: actions/github-script@v7
149+
with:
150+
script: |
151+
const tag = "continuous";
152+
try {
153+
const rel = await github.rest.repos.getReleaseByTag({
154+
owner: context.repo.owner,
155+
repo: context.repo.repo,
156+
tag
157+
});
158+
for (const asset of rel.data.assets) {
159+
await github.rest.repos.deleteReleaseAsset({
160+
owner: context.repo.owner,
161+
repo: context.repo.repo,
162+
asset_id: asset.id
163+
});
164+
}
165+
core.info(`Removed ${rel.data.assets.length} old asset(s) from ${tag}.`);
166+
} catch (error) {
167+
core.info(`No prior ${tag} release to clean, continuing.`);
168+
}
169+
170+
- name: Publish continuous release asset
171+
if: github.ref == 'refs/heads/main'
172+
uses: softprops/action-gh-release@v2
173+
with:
174+
tag_name: continuous
175+
name: Continuous Installer (main)
176+
body: |
177+
Auto-updated installer from `main`.
178+
- Build: `${{ github.run_number }}`
179+
- Commit: `${{ github.sha }}`
180+
- Installer version: `${{ env.INSTALLER_VERSION }}`
181+
prerelease: true
182+
make_latest: false
183+
target_commitish: ${{ github.sha }}
115184
files: gcbm_view/installer/output/*.exe
185+
overwrite_files: true

installer/gcbm_view_installer.iss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
; GCBM View Installer Script
22
; Built with Inno Setup (https://jrsoftware.org/isinfo.php)
33

4-
#define MyAppName "GCBM View"
5-
#define MyAppVersion "0.5.9"
6-
#define MyAppPublisher "Moja Global"
7-
#define MyAppURL "https://moja.global"
8-
#define MyAppExeName "GCBMView.bat"
4+
#define MyAppName "GCBM View"
5+
#ifndef MyAppVersion
6+
#define MyAppVersion "0.5.9"
7+
#endif
8+
#define MyAppPublisher "Moja Global"
9+
#define MyAppURL "https://moja.global"
10+
#define MyAppExeName "GCBMView.bat"
911

1012
[Setup]
1113
AppId={{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}

0 commit comments

Comments
 (0)