Skip to content

Commit d0285b6

Browse files
陈一斌陈一斌
authored andcommitted
Automate GitHub releases for macOS builds
Add a tag-driven GitHub Actions workflow that resolves packages, builds the macOS Release app, zips the .app bundle, and publishes a GitHub Release artifact. Align the app bundle version with the next release tag so the packaged metadata matches the release users download. Constraint: The repository currently has no existing GitHub Actions release pipeline Constraint: Release packaging must work without local code-signing or notarization secrets Rejected: Keep release as a manual push-only step | it does not create a reproducible GitHub Releases artifact Rejected: Add notarization in the first workflow pass | secrets and Apple release credentials are not configured here Confidence: high Scope-risk: moderate Reversibility: clean Directive: Extend this workflow with signing/notarization later instead of replacing the tag-driven release contract Tested: swift build -c release --disable-sandbox Not-tested: Live GitHub Actions execution of the new workflow Not-tested: Signed or notarized macOS distribution artifacts
1 parent d21e471 commit d0285b6

2 files changed

Lines changed: 105 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
release_tag:
10+
description: "Tag to publish, for example v1.0.3"
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
concurrency:
17+
group: release-${{ github.event_name == 'push' && github.ref_name || inputs.release_tag }}
18+
cancel-in-progress: false
19+
20+
jobs:
21+
release:
22+
runs-on: macos-14
23+
24+
steps:
25+
- name: Check Out
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Resolve Release Tag
31+
id: release_tag
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
36+
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
37+
TAG_NAME="${GITHUB_REF_NAME}"
38+
else
39+
TAG_NAME="${{ inputs.release_tag }}"
40+
git fetch --tags origin
41+
if git rev-parse "${TAG_NAME}" >/dev/null 2>&1; then
42+
git checkout "${TAG_NAME}"
43+
else
44+
git tag "${TAG_NAME}" "${GITHUB_SHA}"
45+
git push origin "${TAG_NAME}"
46+
fi
47+
fi
48+
49+
echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT"
50+
51+
- name: Set Up Xcode
52+
uses: maxim-lobanov/setup-xcode@v1
53+
with:
54+
xcode-version: latest-stable
55+
56+
- name: Resolve Swift Packages
57+
run: |
58+
xcodebuild \
59+
-resolvePackageDependencies \
60+
-project SkillsManager.xcodeproj \
61+
-scheme SkillsManager
62+
63+
- name: Build Release App
64+
env:
65+
DERIVED_DATA: ${{ runner.temp }}/DerivedData
66+
run: |
67+
xcodebuild \
68+
-project SkillsManager.xcodeproj \
69+
-scheme SkillsManager \
70+
-configuration Release \
71+
-destination "platform=macOS" \
72+
-derivedDataPath "$DERIVED_DATA" \
73+
CODE_SIGNING_ALLOWED=NO \
74+
build
75+
76+
- name: Package App
77+
id: package
78+
env:
79+
DERIVED_DATA: ${{ runner.temp }}/DerivedData
80+
TAG_NAME: ${{ steps.release_tag.outputs.tag_name }}
81+
shell: bash
82+
run: |
83+
set -euo pipefail
84+
85+
APP_PATH="$(find "$DERIVED_DATA/Build/Products/Release" -maxdepth 1 -name 'Skills Manager.app' -print -quit)"
86+
if [[ -z "$APP_PATH" ]]; then
87+
echo "Release app not found" >&2
88+
exit 1
89+
fi
90+
91+
ZIP_PATH="$RUNNER_TEMP/SkillsManager-${TAG_NAME}.zip"
92+
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "$ZIP_PATH"
93+
94+
echo "app_path=$APP_PATH" >> "$GITHUB_OUTPUT"
95+
echo "zip_path=$ZIP_PATH" >> "$GITHUB_OUTPUT"
96+
97+
- name: Publish GitHub Release
98+
uses: softprops/action-gh-release@v2
99+
with:
100+
tag_name: ${{ steps.release_tag.outputs.tag_name }}
101+
name: Skills Manager ${{ steps.release_tag.outputs.tag_name }}
102+
generate_release_notes: true
103+
files: ${{ steps.package.outputs.zip_path }}

SkillsManager/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<key>CFBundlePackageType</key>
2020
<string>APPL</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>1.0</string>
22+
<string>1.0.3</string>
2323
<key>CFBundleVersion</key>
24-
<string>1</string>
24+
<string>3</string>
2525
<key>LSMinimumSystemVersion</key>
2626
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2727
<key>NSHumanReadableCopyright</key>

0 commit comments

Comments
 (0)