Skip to content

Commit f767f77

Browse files
committed
try: ci workflows for builds
1 parent 616e52a commit f767f77

File tree

11 files changed

+689
-21
lines changed

11 files changed

+689
-21
lines changed

.erb/configs/webpack.config.main.prod.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ export default merge(baseConfig, {
6868
DEBUG_PROD: false,
6969
START_MINIMIZED: false,
7070
IS_SETAPP_BUILD: false,
71+
// Build automation: Environment-based configuration
72+
DESKTOP_APP_URL: process.env.DESKTOP_APP_URL || "https://app.requestly.io",
73+
DISABLE_AUTO_UPDATE: process.env.DISABLE_AUTO_UPDATE || "false",
74+
BUILD_VARIANT: process.env.BUILD_VARIANT || "production",
7175
}),
7276
],
7377

.erb/scripts/bump-version.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
const version = process.argv[2];
6+
if (!version) {
7+
console.error('❌ Version argument required');
8+
console.error('Usage: node bump-version.js <version>');
9+
process.exit(1);
10+
}
11+
12+
// Validate version format (YY.MM.DD or YY.M.D with optional -beta.N suffix)
13+
if (!/^\d{2}\.\d{1,2}\.\d{1,2}(-beta\.\d+)?$/.test(version)) {
14+
console.error(`❌ Invalid version format: ${version}`);
15+
console.error('Expected: YY.MM.DD (e.g., 25.12.5 or 25.12.05)');
16+
console.error('Beta: YY.MM.DD-beta.N (e.g., 25.12.5-beta.1)');
17+
process.exit(1);
18+
}
19+
20+
const rootPackageJson = path.resolve(__dirname, '../../package.json');
21+
const releasePackageJson = path.resolve(__dirname, '../../release/app/package.json');
22+
23+
// Update root package.json
24+
const rootPkg = JSON.parse(fs.readFileSync(rootPackageJson, 'utf8'));
25+
const oldVersion = rootPkg.version;
26+
rootPkg.version = version;
27+
fs.writeFileSync(rootPackageJson, JSON.stringify(rootPkg, null, 2) + '\n');
28+
console.log(`✓ Updated root package.json: ${oldVersion}${version}`);
29+
30+
// Update release/app/package.json
31+
const releasePkg = JSON.parse(fs.readFileSync(releasePackageJson, 'utf8'));
32+
releasePkg.version = version;
33+
fs.writeFileSync(releasePackageJson, JSON.stringify(releasePkg, null, 2) + '\n');
34+
console.log(`✓ Updated release/app/package.json: ${oldVersion}${version}`);
35+
36+
console.log(`\n✅ Version bump complete: v${version}`);
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/bash
2+
set -e # Exit on error
3+
4+
# Configuration
5+
BUILD_OUTPUT="release/build-setapp"
6+
FINAL_OUTPUT="$BUILD_OUTPUT/final"
7+
APP_NAME="Requestly.app"
8+
VERSION=$(node -p "require('./package.json').version")
9+
10+
echo "========================================"
11+
echo "Setapp Post-Processing Automation"
12+
echo "========================================"
13+
echo "Version: $VERSION"
14+
echo ""
15+
16+
# Step 1: Verify build output
17+
echo "Step 1: Verifying build output..."
18+
UNIVERSAL_ZIP="$BUILD_OUTPUT/Requestly-$VERSION-mac-universal.zip"
19+
if [ ! -f "$UNIVERSAL_ZIP" ]; then
20+
echo "❌ ERROR: Universal zip not found at $UNIVERSAL_ZIP"
21+
ls -lh "$BUILD_OUTPUT/"
22+
exit 1
23+
fi
24+
echo "✓ Found: $UNIVERSAL_ZIP"
25+
26+
# Step 2: Create clean output directory
27+
echo ""
28+
echo "Step 2: Creating output directory..."
29+
rm -rf "$FINAL_OUTPUT"
30+
mkdir -p "$FINAL_OUTPUT"
31+
echo "✓ Created: $FINAL_OUTPUT"
32+
33+
# Step 3: Extract .app from universal zip
34+
echo ""
35+
echo "Step 3: Extracting .app from universal zip..."
36+
TEMP_EXTRACT="$BUILD_OUTPUT/temp_extract"
37+
rm -rf "$TEMP_EXTRACT"
38+
mkdir -p "$TEMP_EXTRACT"
39+
unzip -q "$UNIVERSAL_ZIP" -d "$TEMP_EXTRACT"
40+
41+
# Find .app (might be in mac-universal or mac/)
42+
APP_PATH=$(find "$TEMP_EXTRACT" -name "$APP_NAME" -type d | head -n 1)
43+
if [ -z "$APP_PATH" ]; then
44+
echo "❌ ERROR: .app not found in extracted contents"
45+
echo "Contents of $TEMP_EXTRACT:"
46+
ls -R "$TEMP_EXTRACT"
47+
exit 1
48+
fi
49+
echo "✓ Found: $APP_PATH"
50+
51+
# Step 4: Copy .app to final output
52+
echo ""
53+
echo "Step 4: Copying .app to output directory..."
54+
cp -R "$APP_PATH" "$FINAL_OUTPUT/"
55+
echo "✓ Copied to: $FINAL_OUTPUT/$APP_NAME"
56+
57+
# Step 5: Verify and copy AppIcon.png
58+
echo ""
59+
echo "Step 5: Adding AppIcon.png..."
60+
if [ ! -f "assets/AppIcon.png" ]; then
61+
echo "❌ ERROR: assets/AppIcon.png not found"
62+
exit 1
63+
fi
64+
cp "assets/AppIcon.png" "$FINAL_OUTPUT/"
65+
echo "✓ Added: AppIcon.png"
66+
67+
# Step 6: Verify setappPublicKey.pem
68+
echo ""
69+
echo "Step 6: Verifying Setapp public key..."
70+
if [ -f "$FINAL_OUTPUT/$APP_NAME/Contents/Resources/setappPublicKey.pem" ]; then
71+
echo "✓ Found: setappPublicKey.pem in app bundle"
72+
else
73+
echo "⚠ WARNING: setappPublicKey.pem not found in bundle"
74+
fi
75+
76+
# Step 7: Create final submission zip
77+
echo ""
78+
echo "Step 7: Creating final submission package..."
79+
FINAL_ZIP="$BUILD_OUTPUT/Requestly-Setapp-$VERSION.zip"
80+
cd "$FINAL_OUTPUT"
81+
zip -r -q "../$(basename $FINAL_ZIP)" .
82+
cd - > /dev/null
83+
echo "✓ Created: $FINAL_ZIP"
84+
85+
# Step 8: Calculate checksums
86+
echo ""
87+
echo "Step 8: Generating checksums..."
88+
FINAL_SIZE=$(du -h "$FINAL_ZIP" | cut -f1)
89+
FINAL_SHA256=$(shasum -a 256 "$FINAL_ZIP" | cut -d' ' -f1)
90+
91+
# Step 9: Clean up
92+
echo ""
93+
echo "Step 9: Cleaning up..."
94+
rm -rf "$TEMP_EXTRACT"
95+
echo "✓ Cleaned up"
96+
97+
# Summary
98+
echo ""
99+
echo "========================================"
100+
echo "✅ POST-PROCESSING COMPLETE"
101+
echo "========================================"
102+
echo ""
103+
echo "Setapp Submission Package:"
104+
echo " Location: $FINAL_ZIP"
105+
echo " Size: $FINAL_SIZE"
106+
echo " SHA256: $FINAL_SHA256"
107+
echo ""
108+
echo "Ready for submission to Setapp"
109+
echo ""
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
name: Build Orchestrator
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version (YY.MM.DD - leave empty for auto-generation)'
8+
required: false
9+
type: string
10+
default: ''
11+
12+
custom_url:
13+
description: 'Custom App URL (optional - disables auto-update, version bump, draft)'
14+
required: false
15+
type: string
16+
default: ''
17+
18+
build_macos:
19+
description: '🍎 macOS (x64 + ARM64)'
20+
required: true
21+
type: boolean
22+
default: true
23+
24+
build_windows:
25+
description: '🪟 Windows (x64)'
26+
required: true
27+
type: boolean
28+
default: true
29+
30+
build_linux:
31+
description: '🐧 Linux (AppImage)'
32+
required: true
33+
type: boolean
34+
default: true
35+
36+
build_setapp:
37+
description: '📦 Setapp (Universal macOS)'
38+
required: true
39+
type: boolean
40+
default: true
41+
42+
build_variant:
43+
description: 'Build variant (ignored if custom URL provided)'
44+
required: true
45+
type: choice
46+
options:
47+
- production
48+
- beta
49+
default: production
50+
51+
jobs:
52+
prepare:
53+
runs-on: ubuntu-latest
54+
outputs:
55+
version: ${{ steps.version.outputs.version }}
56+
version_tag: ${{ steps.version.outputs.tag }}
57+
should_bump_version: ${{ steps.logic.outputs.should_bump }}
58+
should_create_draft: ${{ steps.logic.outputs.should_draft }}
59+
build_variant: ${{ steps.logic.outputs.variant }}
60+
61+
steps:
62+
- name: Generate or validate version
63+
id: version
64+
run: |
65+
if [ -z "${{ inputs.version }}" ]; then
66+
VERSION=$(date -u +'%y.%-m.%-d')
67+
echo "📅 Auto-generated: v$VERSION"
68+
else
69+
VERSION="${{ inputs.version }}"
70+
if [[ ! "$VERSION" =~ ^[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}(-beta\.[0-9]+)?$ ]]; then
71+
echo "❌ Invalid version format"
72+
exit 1
73+
fi
74+
echo "✅ Using: v$VERSION"
75+
fi
76+
echo "version=$VERSION" >> $GITHUB_OUTPUT
77+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
78+
79+
- name: Determine workflow logic
80+
id: logic
81+
run: |
82+
SHOULD_BUMP="true"
83+
SHOULD_DRAFT="false"
84+
VARIANT="${{ inputs.build_variant }}"
85+
86+
# Custom URL overrides
87+
if [ -n "${{ inputs.custom_url }}" ]; then
88+
echo "::notice title=Custom URL Mode::Auto-update disabled, version bump skipped, draft release skipped"
89+
SHOULD_BUMP="false"
90+
SHOULD_DRAFT="false"
91+
VARIANT="custom"
92+
93+
# Verify only standard platforms selected
94+
if [ "${{ inputs.build_setapp }}" == "true" ]; then
95+
echo "::error title=Invalid Configuration::Setapp builds not allowed with custom URL"
96+
exit 1
97+
fi
98+
fi
99+
100+
# Draft release only for production + all platforms
101+
if [ "$VARIANT" == "production" ] && \
102+
[ "${{ inputs.build_macos }}" == "true" ] && \
103+
[ "${{ inputs.build_windows }}" == "true" ] && \
104+
[ "${{ inputs.build_linux }}" == "true" ] && \
105+
[ "${{ inputs.build_setapp }}" == "true" ]; then
106+
SHOULD_DRAFT="true"
107+
fi
108+
109+
# Beta builds don't get draft releases
110+
if [ "$VARIANT" == "beta" ]; then
111+
SHOULD_DRAFT="false"
112+
fi
113+
114+
echo "should_bump=$SHOULD_BUMP" >> $GITHUB_OUTPUT
115+
echo "should_draft=$SHOULD_DRAFT" >> $GITHUB_OUTPUT
116+
echo "variant=$VARIANT" >> $GITHUB_OUTPUT
117+
118+
bump-version:
119+
needs: prepare
120+
if: needs.prepare.outputs.should_bump_version == 'true'
121+
uses: ./.github/workflows/bump-version.yml
122+
with:
123+
version: ${{ needs.prepare.outputs.version }}
124+
125+
build-macos:
126+
needs: [prepare, bump-version]
127+
if: |
128+
always() &&
129+
inputs.build_macos == true &&
130+
(needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped')
131+
uses: ./.github/workflows/release_desktop_app.yml
132+
secrets: inherit
133+
with:
134+
platform: macos-latest
135+
build_variant: ${{ needs.prepare.outputs.build_variant }}
136+
custom_url: ${{ inputs.custom_url }}
137+
git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }}
138+
139+
build-windows:
140+
needs: [prepare, bump-version]
141+
if: |
142+
always() &&
143+
inputs.build_windows == true &&
144+
(needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped')
145+
uses: ./.github/workflows/release_desktop_app.yml
146+
secrets: inherit
147+
with:
148+
platform: windows-latest
149+
build_variant: ${{ needs.prepare.outputs.build_variant }}
150+
custom_url: ${{ inputs.custom_url }}
151+
git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }}
152+
153+
build-linux:
154+
needs: [prepare, bump-version]
155+
if: |
156+
always() &&
157+
inputs.build_linux == true &&
158+
(needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped')
159+
uses: ./.github/workflows/release_desktop_app.yml
160+
secrets: inherit
161+
with:
162+
platform: ubuntu-latest
163+
build_variant: ${{ needs.prepare.outputs.build_variant }}
164+
custom_url: ${{ inputs.custom_url }}
165+
git_ref: ${{ needs.bump-version.outputs.version_tag || github.ref }}
166+
checkout_branch: draft-linux-fixes
167+
168+
build-setapp:
169+
needs: [prepare, bump-version]
170+
if: |
171+
always() &&
172+
inputs.build_setapp == true &&
173+
inputs.custom_url == '' &&
174+
(needs.bump-version.result == 'success' || needs.bump-version.result == 'skipped')
175+
uses: ./.github/workflows/build-setapp.yml
176+
secrets: inherit
177+
with:
178+
git_ref: ${{ needs.bump-version.outputs.version_tag || 'draft-setapp-wrapper-support' }}
179+
180+
create-draft:
181+
needs: [prepare, build-macos, build-windows, build-linux]
182+
if: |
183+
always() &&
184+
needs.prepare.outputs.should_create_draft == 'true' &&
185+
(needs.build-macos.result == 'success' || needs.build-macos.result == 'skipped') &&
186+
(needs.build-windows.result == 'success' || needs.build-windows.result == 'skipped') &&
187+
(needs.build-linux.result == 'success' || needs.build-linux.result == 'skipped')
188+
uses: ./.github/workflows/create-draft-release.yml
189+
secrets: inherit
190+
with:
191+
version: ${{ needs.prepare.outputs.version }}
192+
version_tag: ${{ needs.prepare.outputs.version_tag }}
193+
artifact_names: 'macos-build,windows-build,linux-build'
194+
195+
summary:
196+
needs: [prepare, build-macos, build-windows, build-linux, build-setapp, create-draft]
197+
if: always()
198+
runs-on: ubuntu-latest
199+
steps:
200+
- name: Generate summary
201+
run: |
202+
echo "# 📦 Build Complete: v${{ needs.prepare.outputs.version }}" >> $GITHUB_STEP_SUMMARY
203+
echo "" >> $GITHUB_STEP_SUMMARY
204+
echo "**Variant**: ${{ needs.prepare.outputs.build_variant }}" >> $GITHUB_STEP_SUMMARY
205+
206+
if [ -n "${{ inputs.custom_url }}" ]; then
207+
echo "**Custom URL**: ${{ inputs.custom_url }}" >> $GITHUB_STEP_SUMMARY
208+
fi
209+
210+
echo "" >> $GITHUB_STEP_SUMMARY
211+
echo "**Platforms Built**:" >> $GITHUB_STEP_SUMMARY
212+
echo "- macOS: ${{ needs.build-macos.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY
213+
echo "- Windows: ${{ needs.build-windows.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY
214+
echo "- Linux: ${{ needs.build-linux.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY
215+
echo "- Setapp: ${{ needs.build-setapp.result == 'success' && '✅' || '⬜' }}" >> $GITHUB_STEP_SUMMARY
216+
217+
echo "" >> $GITHUB_STEP_SUMMARY
218+
if [ "${{ needs.create-draft.result }}" == "success" ]; then
219+
echo "**🎉 Draft Release**: [View Releases](https://github.com/${{ github.repository }}/releases)" >> $GITHUB_STEP_SUMMARY
220+
else
221+
echo "**📥 Artifacts**: [Download from Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
222+
fi

0 commit comments

Comments
 (0)