-
Notifications
You must be signed in to change notification settings - Fork 5
115 lines (100 loc) · 3.72 KB
/
Copy pathbuild.yml
File metadata and controls
115 lines (100 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
name: Build
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:
inputs:
notarize:
description: "Notarize the DMG"
required: false
default: "false"
type: choice
options:
- "false"
- "true"
permissions:
contents: read
jobs:
build:
name: Build · Sign · (Notarize)
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Select latest Xcode
run: sudo xcode-select -s "$(ls -d /Applications/Xcode*.app | sort -V | tail -1)"
- name: Install XcodeGen
run: brew install xcodegen
- name: Generate project
run: xcodegen generate
- name: Build (Debug, no signing)
run: |
mkdir -p build
xcodebuild \
-project CineScreen.xcodeproj \
-scheme CineScreen \
-configuration Debug \
-derivedDataPath build/derived \
-destination 'platform=macOS' \
CODE_SIGN_IDENTITY="-" \
CODE_SIGNING_REQUIRED=NO \
build | tee build/build.log
- name: Import signing certificate
if: github.event_name == 'workflow_dispatch' || github.ref_type == 'tag'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: |
set -euo pipefail
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
KEYCHAIN_PWD=$(openssl rand -hex 16)
security create-keychain -p "$KEYCHAIN_PWD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PWD" "$KEYCHAIN_PATH"
echo "$APPLE_CERTIFICATE" | base64 -d > $RUNNER_TEMP/cert.p12
security import $RUNNER_TEMP/cert.p12 \
-k "$KEYCHAIN_PATH" \
-P "$APPLE_CERTIFICATE_PASSWORD" \
-T /usr/bin/codesign \
-T /usr/bin/security
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PWD" "$KEYCHAIN_PATH"
security list-keychains -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | xargs)
- name: Archive (Release, signed)
if: github.event_name == 'workflow_dispatch' || github.ref_type == 'tag'
run: make archive
- name: Export signed app
if: github.event_name == 'workflow_dispatch' || github.ref_type == 'tag'
run: make export
- name: Create DMG
if: github.event_name == 'workflow_dispatch' || github.ref_type == 'tag'
run: make dmg
- name: Notarize and staple
if: (github.event_name == 'workflow_dispatch' && inputs.notarize == 'true') || github.ref_type == 'tag'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
xcrun notarytool submit build/CineScreen.dmg \
--apple-id "$APPLE_ID" \
--team-id "$APPLE_TEAM_ID" \
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
--wait
xcrun stapler staple build/CineScreen.dmg
- name: Upload DMG artifact
if: github.event_name == 'workflow_dispatch' || github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: CineScreen-mac
path: build/CineScreen.dmg
if-no-files-found: error
- name: Upload build log on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-log
path: build/build.log
if-no-files-found: ignore