Skip to content

Commit 3a0c50d

Browse files
authored
Merge pull request #671 from frstrtr/ci-steward/release-installers
release.yml: wire DMG + Inno Setup installers; per-coin/off-tag rebuild inputs
2 parents c93dcfb + 44c0714 commit 3a0c50d

3 files changed

Lines changed: 155 additions & 43 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ on:
3232
push:
3333
tags: ['v*']
3434
workflow_dispatch:
35+
inputs:
36+
version:
37+
description: "Version string for package names (e.g. 0.2.0). Blank = derive from ref."
38+
required: false
39+
default: ""
40+
coins:
41+
description: "JSON array of coins to build (e.g. [\"ltc\"]). Blank = all five."
42+
required: false
43+
default: ""
3544

3645
concurrency:
3746
group: release-${{ github.ref }}
@@ -50,14 +59,16 @@ jobs:
5059
strategy:
5160
fail-fast: false
5261
matrix:
53-
coin: [btc, ltc, dgb, dash, bch]
62+
coin: ${{ fromJSON(github.event.inputs.coins || '["btc","ltc","dgb","dash","bch"]') }}
5463
steps:
5564
- uses: actions/checkout@v6
5665

5766
- name: Resolve version
5867
id: ver
5968
run: |
60-
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
69+
if [ -n "${{ github.event.inputs.version }}" ]; then
70+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
71+
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
6172
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
6273
else
6374
echo "version=0.0.0-${GITHUB_SHA:0:8}" >> "$GITHUB_OUTPUT"
@@ -186,7 +197,7 @@ jobs:
186197
strategy:
187198
fail-fast: false
188199
matrix:
189-
coin: [btc, ltc, dgb, dash, bch]
200+
coin: ${{ fromJSON(github.event.inputs.coins || '["btc","ltc","dgb","dash","bch"]') }}
190201
arch: [arm64, x86_64]
191202
include:
192203
- arch: arm64
@@ -199,7 +210,9 @@ jobs:
199210
- name: Resolve version
200211
id: ver
201212
run: |
202-
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
213+
if [ -n "${{ github.event.inputs.version }}" ]; then
214+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
215+
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
203216
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
204217
else
205218
echo "version=0.0.0-${GITHUB_SHA:0:8}" >> "$GITHUB_OUTPUT"
@@ -299,14 +312,16 @@ jobs:
299312
strategy:
300313
fail-fast: false
301314
matrix:
302-
coin: [btc, ltc, dgb, dash, bch]
315+
coin: ${{ fromJSON(github.event.inputs.coins || '["btc","ltc","dgb","dash","bch"]') }}
303316
steps:
304317
- uses: actions/checkout@v6
305318

306319
- name: Resolve version
307320
id: ver
308321
run: |
309-
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
322+
if [ -n "${{ github.event.inputs.version }}" ]; then
323+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
324+
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
310325
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
311326
else
312327
echo "version=0.0.0-${GITHUB_SHA:0:8}" >> "$GITHUB_OUTPUT"
@@ -374,6 +389,24 @@ jobs:
374389
name: pkg-macos-${{ matrix.coin }}
375390
path: c2pool-*-macos-universal.zip
376391

392+
- name: Build DMG installer
393+
if: steps.presence.outputs.exists == '1'
394+
run: |
395+
VERSION="${{ steps.ver.outputs.version }}"
396+
COIN="${{ matrix.coin }}"
397+
bash installer/macos/create-dmg.sh \
398+
--staged "c2pool-${COIN}-${VERSION}-macos-universal" \
399+
--name "c2pool-${COIN}" \
400+
--version "${VERSION}" \
401+
--arch universal
402+
403+
- name: Upload DMG installer
404+
if: steps.presence.outputs.exists == '1'
405+
uses: actions/upload-artifact@v7
406+
with:
407+
name: pkg-macos-dmg-${{ matrix.coin }}
408+
path: c2pool-*-macos-universal.dmg
409+
377410
# ════════════════════════════════════════════════════════════════════════════
378411
# Windows x86_64 (MSVC 2022, Conan)
379412
# ════════════════════════════════════════════════════════════════════════════
@@ -383,15 +416,17 @@ jobs:
383416
strategy:
384417
fail-fast: false
385418
matrix:
386-
coin: [btc, ltc, dgb, dash, bch]
419+
coin: ${{ fromJSON(github.event.inputs.coins || '["btc","ltc","dgb","dash","bch"]') }}
387420
steps:
388421
- uses: actions/checkout@v6
389422

390423
- name: Resolve version
391424
id: ver
392425
shell: bash
393426
run: |
394-
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
427+
if [ -n "${{ github.event.inputs.version }}" ]; then
428+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
429+
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
395430
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
396431
else
397432
echo "version=0.0.0-${GITHUB_SHA:0:8}" >> "$GITHUB_OUTPUT"
@@ -490,6 +525,29 @@ jobs:
490525
name: pkg-windows-${{ matrix.coin }}
491526
path: c2pool-*-windows-x86_64.zip
492527

528+
- name: Build setup.exe installer (Inno Setup)
529+
if: steps.presence.outputs.exists == '1'
530+
shell: cmd
531+
run: |
532+
choco install innosetup -y --no-progress
533+
set "PKG=c2pool-${{ matrix.coin }}-${{ steps.ver.outputs.version }}-windows-x86_64"
534+
for /f "delims=" %%i in ('powershell -NoProfile -Command "(Get-ChildItem -Path 'C:\Program Files\Microsoft Visual Studio\2022' -Recurse -Filter vc_redist.x64.exe -ErrorAction SilentlyContinue | Select-Object -First 1).FullName"') do set "VCREDIST=%%i"
535+
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\windows\c2pool-setup.iss ^
536+
/DPACKAGE_DIR="%CD%\%PKG%" ^
537+
/DVCREDIST_PATH="%VCREDIST%" ^
538+
/DMyAppName=c2pool-${{ matrix.coin }} ^
539+
/DMyAppVersion=${{ steps.ver.outputs.version }} ^
540+
/DMyAppExeName=c2pool-${{ matrix.coin }}.exe ^
541+
/DOutputBase=%PKG%-setup
542+
copy "installer\windows\Output\%PKG%-setup.exe" .
543+
544+
- name: Upload setup.exe installer
545+
if: steps.presence.outputs.exists == '1'
546+
uses: actions/upload-artifact@v7
547+
with:
548+
name: pkg-windows-setup-${{ matrix.coin }}
549+
path: c2pool-*-windows-x86_64-setup.exe
550+
493551
# ════════════════════════════════════════════════════════════════════════════
494552
# Aggregate: single SHA256SUMS over every produced package; on tags,
495553
# attach everything to a DRAFT release (operator publishes manually).

installer/macos/create-dmg.sh

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,71 @@
11
#!/bin/bash
22
# c2pool macOS DMG builder
33
#
4-
# Usage:
5-
# ./create-dmg.sh <binary> <arch>
4+
# Two modes:
65
#
7-
# Examples:
8-
# ./create-dmg.sh ~/c2pool-build/build/src/c2pool/c2pool x86_64
9-
# ./create-dmg.sh ~/c2pool-build/build-arm64/src/c2pool/c2pool arm64
6+
# 1. Staged mode (used by release.yml — wraps an already-assembled universal
7+
# package directory into a .dmg):
8+
# ./create-dmg.sh --staged <pkgdir> --name c2pool-ltc --version 0.2.0 --arch universal
9+
# <pkgdir> must already contain the binary, lib/, web-static/, config/,
10+
# start.sh — i.e. the exact tree the release matrix stages/lipo-merges.
11+
# No asset copying or dylib rewriting is done here; the staged tree
12+
# (which already has @executable_path-fixed dylibs) is shipped verbatim.
13+
# Output: <name>-<version>-macos-<arch>.dmg
1014
#
11-
# The script expects web-static/, explorer/, config/, start.sh in the
12-
# repo root (same level as src/). Output: c2pool-VERSION-macos-ARCH.dmg
15+
# 2. Legacy single-binary mode (per-arch, alpha compatible):
16+
# ./create-dmg.sh <binary> <arch>
1317

1418
set -e
1519

16-
BINARY="$1"
17-
ARCH="${2:-$(uname -m)}"
18-
VERSION="0.1.1-alpha"
20+
STAGED=""
21+
NAME=""
22+
VERSION=""
23+
ARCH=""
24+
BINARY=""
25+
26+
# Flag parsing (staged mode) with positional fallback (legacy mode)
27+
while [ $# -gt 0 ]; do
28+
case "$1" in
29+
--staged) STAGED="$2"; shift 2 ;;
30+
--name) NAME="$2"; shift 2 ;;
31+
--version) VERSION="$2"; shift 2 ;;
32+
--arch) ARCH="$2"; shift 2 ;;
33+
*)
34+
if [ -z "$BINARY" ]; then BINARY="$1"; else ARCH="$1"; fi
35+
shift ;;
36+
esac
37+
done
38+
39+
# ── Staged mode ─────────────────────────────────────────────────────────────
40+
if [ -n "$STAGED" ]; then
41+
[ -n "$NAME" ] || { echo "ERROR: --name required with --staged"; exit 1; }
42+
[ -n "$VERSION" ] || { echo "ERROR: --version required with --staged"; exit 1; }
43+
ARCH="${ARCH:-universal}"
44+
[ -d "$STAGED" ] || { echo "ERROR: staged dir not found: $STAGED"; exit 1; }
45+
VOLNAME="${NAME}-${VERSION}"
46+
DMG_NAME="${NAME}-${VERSION}-macos-${ARCH}.dmg"
47+
echo "Building $DMG_NAME from staged tree $STAGED"
48+
rm -f "$DMG_NAME"
49+
hdiutil create -volname "$VOLNAME" \
50+
-srcfolder "$STAGED" \
51+
-ov -format UDZO \
52+
"$DMG_NAME"
53+
echo ""
54+
echo "Created: $DMG_NAME"
55+
echo "Size: $(du -h "$DMG_NAME" | cut -f1)"
56+
echo "SHA256: $(shasum -a 256 "$DMG_NAME" | cut -d' ' -f1)"
57+
exit 0
58+
fi
59+
60+
# ── Legacy single-binary mode (unchanged alpha behaviour) ───────────────────
61+
ARCH="${ARCH:-$(uname -m)}"
62+
VERSION="${VERSION:-0.1.1-alpha}"
1963
VOLNAME="c2pool-${VERSION}"
2064
DMG_NAME="c2pool-${VERSION}-macos-${ARCH}.dmg"
2165

2266
if [ -z "$BINARY" ] || [ ! -f "$BINARY" ]; then
2367
echo "Usage: $0 <path-to-c2pool-binary> [arch]"
24-
echo " arch: x86_64 or arm64 (default: native)"
68+
echo " or: $0 --staged <pkgdir> --name <name> --version <ver> [--arch <arch>]"
2569
exit 1
2670
fi
2771

@@ -83,8 +127,6 @@ STARTEOF
83127
fi
84128

85129
# Copy secp256k1 dylib and fix load path
86-
# Detect the actual linked path from the binary (Homebrew may use Cellar paths
87-
# like /usr/local/opt/secp256k1/lib/ instead of /usr/local/lib/)
88130
LINKED_SECP=$(otool -L "$APP_DIR/c2pool" | grep secp256k1 | awk '{print $1}')
89131
if [ -n "$LINKED_SECP" ] && [ -f "$LINKED_SECP" ]; then
90132
SECP_REAL=$(realpath "$LINKED_SECP")
@@ -93,7 +135,6 @@ if [ -n "$LINKED_SECP" ] && [ -f "$LINKED_SECP" ]; then
93135
install_name_tool -change "$LINKED_SECP" "@executable_path/lib/libsecp256k1.6.dylib" "$APP_DIR/c2pool"
94136
echo " secp256k1: $LINKED_SECP -> @executable_path/lib/libsecp256k1.6.dylib"
95137
else
96-
# Fallback: try known paths
97138
if [ "$ARCH" = "arm64" ]; then
98139
SECP_SEARCH="/Users/user0/arm64-deps/lib /opt/homebrew/lib"
99140
else
@@ -103,7 +144,6 @@ else
103144
if [ -f "$DIR/libsecp256k1.6.dylib" ]; then
104145
cp "$DIR/libsecp256k1.6.dylib" "$APP_DIR/lib/libsecp256k1.6.dylib"
105146
ln -sf libsecp256k1.6.dylib "$APP_DIR/lib/libsecp256k1.dylib"
106-
# Try all possible linked names
107147
for CANDIDATE in "$DIR/libsecp256k1.dylib" "$DIR/libsecp256k1.6.dylib"; do
108148
install_name_tool -change "$CANDIDATE" "@executable_path/lib/libsecp256k1.6.dylib" "$APP_DIR/c2pool" 2>/dev/null || true
109149
done

installer/windows/c2pool-setup.iss

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
; c2pool Windows Installer — Inno Setup Script
22
;
33
; Usage:
4-
; 1. Build c2pool.exe and prepare the package directory (see PACKAGE_DIR below)
5-
; 2. Set PACKAGE_DIR and VCREDIST_PATH below to match your build environment
6-
; 3. Compile: "C:\...\Inno Setup 6\ISCC.exe" c2pool-setup.iss
4+
; 1. Build c2pool-<coin>.exe and prepare the package directory (PACKAGE_DIR)
5+
; 2. Compile, overriding the per-package defines on the ISCC command line:
6+
; ISCC.exe c2pool-setup.iss ^
7+
; /DPACKAGE_DIR=C:\path\to\c2pool-ltc-0.2.0-windows-x86_64 ^
8+
; /DVCREDIST_PATH=C:\...\vc_redist.x64.exe ^
9+
; /DMyAppName=c2pool-ltc /DMyAppVersion=0.2.0 ^
10+
; /DMyAppExeName=c2pool-ltc.exe ^
11+
; /DOutputBase=c2pool-ltc-0.2.0-windows-x86_64-setup
712
;
813
; The package directory should contain:
9-
; c2pool.exe, start.bat, lib\*, web-static\*, explorer\*, config\*
14+
; <exe>, start.bat, lib\*, web-static\*, explorer\*, config\*
1015

1116
; ── Configurable paths ──────────────────────────────────────────────────────
1217
; Override on ISCC command line: /DPACKAGE_DIR=C:\path\to\package
@@ -17,22 +22,31 @@
1722
#define VCREDIST_PATH "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\v143\vc_redist.x64.exe"
1823
#endif
1924

20-
; ── App metadata ────────────────────────────────────────────────────────────
21-
#define MyAppName "c2pool"
22-
#define MyAppVersion "0.1.1-alpha"
25+
; ── App metadata (all overridable via /D for per-coin packages) ─────────────
26+
#ifndef MyAppName
27+
#define MyAppName "c2pool"
28+
#endif
29+
#ifndef MyAppVersion
30+
#define MyAppVersion "0.1.1-alpha"
31+
#endif
32+
#ifndef MyAppExeName
33+
#define MyAppExeName "c2pool.exe"
34+
#endif
35+
#ifndef OutputBase
36+
#define OutputBase "c2pool-" + MyAppVersion + "-windows-x86_64-setup"
37+
#endif
2338
#define MyAppPublisher "frstrtr"
2439
#define MyAppURL "https://github.com/frstrtr/c2pool"
25-
#define MyAppExeName "c2pool.exe"
2640

2741
[Setup]
2842
AppId={{C2POOL-MINING-POOL}
2943
AppName={#MyAppName}
3044
AppVersion={#MyAppVersion}
3145
AppPublisher={#MyAppPublisher}
3246
AppPublisherURL={#MyAppURL}
33-
DefaultDirName={autopf}\c2pool
34-
DefaultGroupName=c2pool
35-
OutputBaseFilename=c2pool-{#MyAppVersion}-windows-x86_64-setup
47+
DefaultDirName={autopf}\{#MyAppName}
48+
DefaultGroupName={#MyAppName}
49+
OutputBaseFilename={#OutputBase}
3650
Compression=lzma2
3751
SolidCompression=yes
3852
WizardStyle=modern
@@ -44,8 +58,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
4458

4559
[Files]
4660
; Main binary
47-
Source: "{#PACKAGE_DIR}\c2pool.exe"; DestDir: "{app}"; Flags: ignoreversion
48-
; DLLs (secp256k1, etc.) — must be next to c2pool.exe for Windows DLL search
61+
Source: "{#PACKAGE_DIR}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
62+
; DLLs (secp256k1, etc.) — must be next to the exe for Windows DLL search
4963
Source: "{#PACKAGE_DIR}\lib\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
5064
; Web dashboard
5165
Source: "{#PACKAGE_DIR}\web-static\*"; DestDir: "{app}\web-static"; Flags: ignoreversion recursesubdirs createallsubdirs
@@ -58,19 +72,19 @@ Source: "{#PACKAGE_DIR}\start.bat"; DestDir: "{app}"; Flags: ignoreversion
5872
; Transition message blobs (authority-signed V36 upgrade signal)
5973
Source: "{#PACKAGE_DIR}\transition_messages\*"; DestDir: "{app}\transition_messages"; Flags: ignoreversion recursesubdirs createallsubdirs skipifsourcedoesntexist
6074
; VC++ Redistributable (installed silently, deleted after)
61-
Source: "{#VCREDIST_PATH}"; DestDir: "{tmp}"; Flags: deleteafterinstall
75+
Source: "{#VCREDIST_PATH}"; DestDir: "{tmp}"; Flags: deleteafterinstall skipifsourcedoesntexist
6276

6377
[Icons]
64-
Name: "{group}\c2pool"; Filename: "{app}\c2pool.exe"; Parameters: "--integrated --net litecoin --dashboard-dir ""{app}\web-static"""; WorkingDir: "{app}"
65-
Name: "{group}\c2pool (start.bat)"; Filename: "{app}\start.bat"; WorkingDir: "{app}"
66-
Name: "{group}\Uninstall c2pool"; Filename: "{uninstallexe}"
67-
Name: "{commondesktop}\c2pool"; Filename: "{app}\c2pool.exe"; Parameters: "--integrated --net litecoin --dashboard-dir ""{app}\web-static"""; WorkingDir: "{app}"
78+
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--integrated --net litecoin --dashboard-dir ""{app}\web-static"""; WorkingDir: "{app}"
79+
Name: "{group}\{#MyAppName} (start.bat)"; Filename: "{app}\start.bat"; WorkingDir: "{app}"
80+
Name: "{group}\Uninstall {#MyAppName}"; Filename: "{uninstallexe}"
81+
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "--integrated --net litecoin --dashboard-dir ""{app}\web-static"""; WorkingDir: "{app}"
6882

6983
[Run]
7084
; Install VC++ Runtime (skip if already present)
71-
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "Installing Visual C++ Runtime..."; Flags: waituntilterminated
85+
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "Installing Visual C++ Runtime..."; Flags: waituntilterminated skipifdoesntexist
7286
; Offer to launch after install
73-
Filename: "{app}\c2pool.exe"; Description: "Launch c2pool"; Flags: nowait postinstall skipifsilent; Parameters: "--integrated --net litecoin --dashboard-dir ""{app}\web-static"""
87+
Filename: "{app}\{#MyAppExeName}"; Description: "Launch {#MyAppName}"; Flags: nowait postinstall skipifsilent; Parameters: "--integrated --net litecoin --dashboard-dir ""{app}\web-static"""
7488

7589
[Code]
7690
var

0 commit comments

Comments
 (0)