-
-
Notifications
You must be signed in to change notification settings - Fork 7
107 lines (93 loc) · 3.66 KB
/
build.yml
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
name: Build app
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
name: Build and Upload Moc.app
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Task
run: brew install go-task/tap/go-task
- name: Set Xcode version
run: |
sudo xcode-select -s /Applications/Xcode_14.1.app
- name: Set up environment
run: |
if [[ -z "${{ secrets.API_ID }}" || -z "${{ secrets.API_HASH }}" ]]
then
echo "\$API_ID or \$API_HASH is empty. Reverting to default macOS client's credentials."
else
echo "Using secrets provided API_ID & API_HASH"
API_ID=${{ secrets.API_ID }}
API_HASH=${{ secrets.API_HASH }}
fi
rm '/usr/local/bin/swiftlint'
task setup
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Build
run: task clean release:macOS
- name: Move artifact
run: |
mv ~/Library/Developer/Xcode/DerivedData/Moc-*/Build/Products/Release/Moc.app Moc.app
- name: Get Version and Build number
run: |
APP_VERSION=$(/usr/libexec/PlistBuddy -c 'print ":CFBundleShortVersionString"' Moc.app/Contents/Info.plist)
APP_BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c 'print ":CFBundleVersion"' Moc.app/Contents/Info.plist)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "APP_BUILD_NUMBER=$APP_BUILD_NUMBER" >> $GITHUB_ENV
- name: Make .dmg
env:
APP_PATH: Moc.app
DMG_PATH: Moc.dmg
run: task package:macOS
- name: Prepare artifact for upload
run: |
mkdir artifact
mv Moc.dmg artifact/
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: Moc
path: artifact/
if-no-files-found: error
- name: Remove previous release (master only)
if: github.ref == 'refs/heads/master'
uses: dev-drprasad/delete-tag-and-release@85fa8bcea0379a6ada9bbfdcb0a9d24d58e1a0d7
with:
delete_release: true
tag_name: nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release (master only)
uses: softprops/action-gh-release@fe9a9bd3295828558c7a3c004f23f3bf77d155b2
if: github.ref == 'refs/heads/master'
with:
tag_name: nightly
name: ${{ env.APP_VERSION }} Nightly
files: artifact/Moc.dmg
prerelease: true
generate_release_notes: true