Repository navigation
64 lines (55 loc) · 1.8 KB
/
Copy pathrelease.yml
File metadata and controls
64 lines (55 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Publish release
on:
push:
branches:
- main
paths:
- Packaging/Info.plist
- .github/workflows/release.yml
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Select Xcode 16.4
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
- name: Read version
id: version
shell: bash
run: |
version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' Packaging/Info.plist)
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid CFBundleShortVersionString: $version" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
- name: Build app
run: ./Packaging/build-app.sh
- name: Package app
shell: bash
run: |
asset=".build/package/NotchFlow-${{ steps.version.outputs.version }}.zip"
ditto -c -k --keepParent .build/package/NotchFlow.app "$asset"
(
cd "$(dirname "$asset")"
shasum -a 256 "$(basename "$asset")" > "$(basename "$asset").sha256"
)
echo "ASSET=$asset" >> "$GITHUB_ENV"
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.version.outputs.tag }}
shell: bash
run: |
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" "$ASSET" "$ASSET.sha256" --clobber
else
gh release create "$TAG" "$ASSET" "$ASSET.sha256" \
--target "$GITHUB_SHA" \
--title "NotchFlow $TAG" \
--generate-notes
fi