@@ -3,62 +3,71 @@ name: Release
33on :
44 push :
55 tags :
6- - ' *'
6+ - " *"
7+
8+ permissions :
9+ contents : write
710
811jobs :
9- build :
10- runs-on : macos-latest
11- env :
12- DEVELOPER_DIR : /Applications/Xcode_15.4.app/Contents/Developer
12+ release :
13+ runs-on : macos-26
14+ timeout-minutes : 30
1315
1416 steps :
15- - uses : actions/checkout@v2
17+ - uses : actions/checkout@v6
18+
19+ - name : Import signing certificate
20+ env :
21+ CERTIFICATE_PASSWORD : ${{ secrets.CERTIFICATE_PASSWORD }}
22+ CERTIFICATE_P12 : ${{ secrets.CERTIFICATE_P12 }}
23+ run : |
24+ KEYCHAIN_PATH="$RUNNER_TEMP/build.keychain-db"
25+ CERTIFICATE_PATH="$RUNNER_TEMP/certificate.p12"
1626
17- # See more details at https://docs.github.com/ja/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
18- - name : Import Certificate
19- env :
20- CERTIFICATE_PASSWORD : ${{ secrets.CERTIFICATE_PASSWORD }}
21- CERTIFICATE_P12 : ${{ secrets.CERTIFICATE_P12 }}
22- run : |
23- echo $CERTIFICATE_P12 | base64 --decode > certificate.p12
24- security create-keychain -p runner build.keychain
25- security default-keychain -s build.keychain
26- security unlock-keychain -p runner build.keychain
27- security import certificate.p12 -k build.keychain -P $CERTIFICATE_PASSWORD -T /usr/bin/codesign
27+ printf '%s' "$CERTIFICATE_P12" | base64 --decode > "$CERTIFICATE_PATH"
28+ security create-keychain -p runner "$KEYCHAIN_PATH"
29+ security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
30+ security unlock-keychain -p runner "$KEYCHAIN_PATH"
31+ security import "$CERTIFICATE_PATH" \
32+ -k "$KEYCHAIN_PATH" \
33+ -P "$CERTIFICATE_PASSWORD" \
34+ -T /usr/bin/codesign
35+ security set-key-partition-list \
36+ -S apple-tool:,apple: \
37+ -s \
38+ -k runner \
39+ "$KEYCHAIN_PATH"
40+ security list-keychains -d user -s "$KEYCHAIN_PATH"
2841
29- - name : Allow keychain access
30- run : |
31- security set-key-partition-list -S apple-tool:,apple: -s -k runner build.keychain
42+ - name : Run tests
43+ run : |
44+ xcodebuild test \
45+ -project TrackpadAir.xcodeproj \
46+ -scheme TrackpadAir \
47+ -destination 'platform=macOS'
3248
33- - name : Build app
34- run : xcodebuild -scheme TrackpadAir -project TrackpadAir.xcodeproj build
49+ - name : Archive app
50+ run : |
51+ xcodebuild archive \
52+ -project TrackpadAir.xcodeproj \
53+ -scheme TrackpadAir \
54+ -archivePath "$RUNNER_TEMP/TrackpadAir.xcarchive"
3555
36- - name : Archive app
37- run : xcodebuild -scheme TrackpadAir -project TrackpadAir.xcodeproj archive -archivePath TrackpadAir.xcarchive
56+ - name : Package app
57+ run : |
58+ ditto -c -k --keepParent \
59+ "$RUNNER_TEMP/TrackpadAir.xcarchive/Products/Applications/TrackpadAir.app" \
60+ TrackpadAir.app.zip
3861
39- - name : Zip .app file from Archive
40- run : |
41- cd TrackpadAir.xcarchive/Products/Applications
42- zip -r TrackpadAir.app.zip TrackpadAir.app
43- mv TrackpadAir.app.zip ../../../
62+ - name : Create GitHub release
63+ env :
64+ GH_TOKEN : ${{ github.token }}
65+ run : |
66+ gh release create "$GITHUB_REF_NAME" \
67+ TrackpadAir.app.zip \
68+ --generate-notes \
69+ --verify-tag
4470
45- - name : Create Release
46- id : create_release
47- uses : actions/create-release@v1
48- env :
49- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50- with :
51- tag_name : ${{ github.ref }}
52- release_name : v${{ github.ref }}
53- draft : false
54- prerelease : false
55-
56- - name : Upload Release Asset
57- uses : actions/upload-release-asset@v1
58- env :
59- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60- with :
61- upload_url : ${{ steps.create_release.outputs.upload_url }}
62- asset_path : ./TrackpadAir.app.zip
63- asset_name : TrackpadAir.app.zip
64- asset_content_type : application/zip
71+ - name : Clean up keychain
72+ if : always()
73+ run : security delete-keychain "$RUNNER_TEMP/build.keychain-db" || true
0 commit comments