-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (98 loc) · 3.72 KB
/
release.yml
File metadata and controls
117 lines (98 loc) · 3.72 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-and-release:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: Install tools
run: brew install xcodegen create-dmg
- name: Set version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" Echoic/Resources/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${{ github.run_number }}" Echoic/Resources/Info.plist
- name: Generate Xcode project
run: xcodegen generate
- name: Import signing certificate
env:
CERTIFICATE_P12: ${{ secrets.CERTIFICATE_P12 }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
CERT_PATH=$RUNNER_TEMP/certificate.p12
echo -n "$CERTIFICATE_P12" | base64 --decode -o "$CERT_PATH"
security create-keychain -p "" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "" "$KEYCHAIN_PATH"
security import "$CERT_PATH" -P "$CERTIFICATE_PASSWORD" \
-A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple: \
-k "" "$KEYCHAIN_PATH"
security list-keychain -d user -s "$KEYCHAIN_PATH"
- name: Build
env:
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
run: |
xcodebuild -scheme Echoic \
-configuration Release \
-destination 'platform=macOS,arch=arm64' \
-archivePath build/Echoic.xcarchive \
CODE_SIGN_STYLE=Manual \
CODE_SIGN_IDENTITY="Developer ID Application" \
DEVELOPMENT_TEAM="$DEVELOPMENT_TEAM" \
archive
- name: Export app
run: |
cat > build/ExportOptions.plist << 'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>developer-id</string>
</dict>
</plist>
PLIST
xcodebuild -exportArchive \
-archivePath build/Echoic.xcarchive \
-exportOptionsPlist build/ExportOptions.plist \
-exportPath build/export
- name: Create DMG
run: |
create-dmg \
--volname "Echoic" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "Echoic.app" 150 190 \
--app-drop-link 450 190 \
"build/Echoic-${GITHUB_REF_NAME}.dmg" \
"build/export/Echoic.app"
- name: Notarize DMG
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.DEVELOPMENT_TEAM }}
run: |
xcrun notarytool submit "build/Echoic-${GITHUB_REF_NAME}.dmg" \
--apple-id "$APPLE_ID" \
--password "$APPLE_ID_PASSWORD" \
--team-id "$APPLE_TEAM_ID" \
--wait
xcrun stapler staple "build/Echoic-${GITHUB_REF_NAME}.dmg"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
"build/Echoic-${GITHUB_REF_NAME}.dmg" \
--title "Echoic ${GITHUB_REF_NAME}" \
--generate-notes