Skip to content

Commit 3a77310

Browse files
adevraclaude
andcommitted
Replace CI workflow with build & release pipeline
Builds app bundle, creates DMG + ZIP, and publishes a GitHub Release. Triggered by version tags (v*) or manual dispatch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5a18dbb commit 3a77310

1 file changed

Lines changed: 71 additions & 13 deletions

File tree

.github/workflows/swift.yml

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,80 @@
1-
# This workflow will build a Swift project
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3-
4-
name: Swift
1+
name: Build & Release
52

63
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Release version (e.g. 1.0.0)"
8+
required: true
9+
default: "1.0.0"
710
push:
8-
branches: [ "main" ]
9-
pull_request:
10-
branches: [ "main" ]
11+
tags:
12+
- "v*"
1113

1214
jobs:
1315
build:
16+
runs-on: macos-15
1417

15-
runs-on: macos-latest
18+
permissions:
19+
contents: write
1620

1721
steps:
18-
- uses: actions/checkout@v4
19-
- name: Build
20-
run: swift build -v
21-
- name: Run tests
22-
run: swift test -v
22+
- uses: actions/checkout@v4
23+
24+
- name: Set version from tag or input
25+
run: |
26+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
27+
VERSION="${GITHUB_REF_NAME#v}"
28+
else
29+
VERSION="${{ github.event.inputs.version }}"
30+
fi
31+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
32+
33+
- name: Build release binary
34+
run: swift build -c release
35+
36+
- name: Create app bundle
37+
run: |
38+
APP_NAME="Dispres"
39+
BUNDLE_DIR="$APP_NAME.app"
40+
CONTENTS="$BUNDLE_DIR/Contents"
41+
MACOS="$CONTENTS/MacOS"
42+
RESOURCES="$CONTENTS/Resources"
43+
44+
mkdir -p "$MACOS" "$RESOURCES"
45+
cp ".build/release/$APP_NAME" "$MACOS/$APP_NAME"
46+
cp "Sources/Dispres/Resources/Info.plist" "$CONTENTS/Info.plist"
47+
48+
# Stamp version into Info.plist
49+
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" "$CONTENTS/Info.plist"
50+
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $VERSION" "$CONTENTS/Info.plist"
51+
52+
if [ -f "AppIcon.icns" ]; then
53+
cp "AppIcon.icns" "$RESOURCES/AppIcon.icns"
54+
fi
55+
56+
codesign --force --sign - "$BUNDLE_DIR"
57+
58+
- name: Create DMG
59+
run: |
60+
hdiutil create -volname "Dispres" \
61+
-srcfolder Dispres.app \
62+
-ov -format UDZO \
63+
"Dispres-$VERSION-macOS.dmg"
64+
65+
- name: Create ZIP
66+
run: |
67+
ditto -c -k --sequesterRsrc --keepParent Dispres.app "Dispres-$VERSION-macOS.zip"
68+
69+
- name: Create GitHub Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}', env.VERSION) }}
73+
name: Dispres v${{ env.VERSION }}
74+
draft: false
75+
generate_release_notes: true
76+
files: |
77+
Dispres-${{ env.VERSION }}-macOS.dmg
78+
Dispres-${{ env.VERSION }}-macOS.zip
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)