@@ -3,15 +3,15 @@ name: Release
33on :
44 push :
55 tags :
6- - ' v* '
6+ - " v* "
77 workflow_dispatch :
88 inputs :
99 version :
10- description : ' Version number (e.g., 1.0.0)'
10+ description : " Version number (e.g., 1.0.0)"
1111 required : true
1212 type : string
1313 notes :
14- description : ' Version notes'
14+ description : " Version notes"
1515 required : false
1616 type : string
1717
2424 runs-on : macos-15
2525 outputs :
2626 version : ${{ steps.version.outputs.VERSION }}
27-
27+
2828 steps :
2929 - name : Generate App Token
3030 id : app-token
4343 run : |
4444 git config user.name "github-actions[bot]"
4545 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
46-
46+
4747 - name : Verify Xcode version
4848 run : |
4949 xcodebuild -version
@@ -54,12 +54,12 @@ jobs:
5454 run : |
5555 VERSION="${{ inputs.version }}"
5656 VERSION="${VERSION#v}"
57-
57+
5858 PROJECT_VERSION=$(sed -nE 's/.*MARKETING_VERSION = ([0-9]+\.[0-9]+\.[0-9]+);.*/\1/p' MiddleDrag.xcodeproj/project. pbxproj | head -n 1)
59-
59+
6060 if [ "$VERSION" != "$PROJECT_VERSION" ]; then
6161 echo "Version mismatch ($PROJECT_VERSION vs $VERSION). Bumping..."
62-
62+
6363 # For workflow_dispatch, determine the branch
6464 if [[ "$GITHUB_REF" == refs/heads/* ]]; then
6565 BRANCH_NAME=${GITHUB_REF#refs/heads/}
@@ -68,18 +68,18 @@ jobs:
6868 BRANCH_NAME="main"
6969 echo "Not on a branch ref, using $BRANCH_NAME"
7070 fi
71-
71+
7272 git fetch origin "$BRANCH_NAME"
7373 git checkout "$BRANCH_NAME"
7474 git reset --hard "origin/$BRANCH_NAME"
75-
75+
7676 NOTES="${{ inputs.notes }}"
7777 ./bump-version.sh "$VERSION" "$NOTES"
78-
78+
7979 # Rebase on latest main in case of new commits
8080 git fetch origin "$BRANCH_NAME"
8181 git rebase "origin/$BRANCH_NAME"
82-
82+
8383 git push origin "$BRANCH_NAME" --force-with-lease
8484 git push origin "v$VERSION"
8585
9696 token : ${{ steps.app-token.outputs.token }}
9797 ref : ${{ env.NEW_SHA }}
9898 fetch-depth : 0
99-
99+
100100 - name : Get version
101101 id : version
102102 env :
@@ -134,7 +134,7 @@ jobs:
134134 key : spm-${{ runner.os }}-${{ hashFiles('**/Package.resolved') }}
135135 restore-keys : |
136136 spm-${{ runner.os }}-
137-
137+
138138 - name : Build Release
139139 run : |
140140 xcodebuild -scheme MiddleDrag \
@@ -167,14 +167,14 @@ jobs:
167167 done
168168 return $failed
169169 }
170-
170+
171171 VERSION="${{ steps.version.outputs.VERSION }}"
172-
172+
173173 (cd build/Build/Products/Release && zip -r "$GITHUB_WORKSPACE/MiddleDrag-${VERSION}.zip" MiddleDrag.app) &
174174 ZIP_PID=$!
175175 sentry-cli debug-files upload --include-sources build/Build/Products/Release/ &
176176 SENTRY_PID=$!
177-
177+
178178 wait_all "$ZIP_PID" "$SENTRY_PID" || { echo "❌ A background job failed"; exit 1; }
179179
180180 - name : Create Sentry release
@@ -188,7 +188,7 @@ jobs:
188188 sentry-cli releases set-commits "$VERSION" --auto
189189 sentry-cli releases finalize "$VERSION"
190190 sentry-cli releases deploys "$VERSION" new -e production
191-
191+
192192 - name : Generate SHA256
193193 id : sha
194194 run : |
@@ -216,16 +216,17 @@ jobs:
216216 with :
217217 tag_name : v${{ steps.version.outputs.VERSION }}
218218 name : v${{ steps.version.outputs.VERSION }}
219- target_commitish : ${{ github.sha }}
219+ target_commitish : ${{ env.NEW_SHA || github.sha }}
220220 generate_release_notes : ${{ steps.tag_message.outputs.GENERATE_NOTES }}
221221 body : |
222222 ${{ steps.tag_message.outputs.MESSAGE }}
223223
224224 ---
225225 **SHA256:** `${{ steps.sha.outputs.SHA256 }}`
226226 files : MiddleDrag-${{ steps.version.outputs.VERSION }}.zip
227-
227+
228228 - name : Trigger Homebrew Update
229+ if : github.event_name == 'push'
229230 env :
230231 VERSION : ${{ steps.version.outputs.VERSION }}
231232 GH_TOKEN : ${{ github.token }}
0 commit comments