-
Notifications
You must be signed in to change notification settings - Fork 4
191 lines (163 loc) · 6.7 KB
/
release-ci.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Aesir Release Pipeline
on:
push:
branches:
- master
tags:
- '*'
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{steps.create_release.outputs.upload_url}}
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
build:
name: "Build: ${{ matrix.config.name }} / ${{ matrix.config.platform }}"
runs-on: ${{ matrix.config.os }}
needs: [create-release]
strategy:
fail-fast: true
matrix:
config:
- {
name: "Windows Latest",
os: windows-latest,
platform: x64
}
- {
name: "Ubuntu Latest",
os: ubuntu-latest,
platform: x64
}
- {
name: "macOS-x64",
os: macos-latest,
platform: x64
}
- {
name: "macOS arm64",
os: macos-latest,
platform: arm64
}
env:
PLATFORM: ${{ matrix.config.platform }}
VERSION: ${{ github.ref_name }} # This extracts the tag name
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 18.13.0
- name: Install python-setuptools on macOS
if: matrix.config.os == 'macos-11' || matrix.config.os == 'macos-latest'
run: brew install python-setuptools
- name: Install snap on Linux
if: matrix.config.os == 'ubuntu-latest'
run: sudo snap install snapcraft --classic
- name: Install the Apple certificate and provisioning profile
if: matrix.config.os == 'macos-latest'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
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 -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_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 set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# Apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Install dependencies
run: npm install --quiet
- name: Build ${{ matrix.config.name }}
if: matrix.config.os == 'windows-latest'
run: npm run build:win-x64
- name: Build ${{ matrix.config.name }}
if: matrix.config.os == 'ubuntu-latest'
run: npm run build:linux-$PLATFORM
- name: Build ${{ matrix.config.name }}
if: matrix.config.os == 'macos-latest'
run: npm run build:mac-$PLATFORM
- name: Sign the macOS Application
if: matrix.config.os == 'macos-latest'
run: codesign --deep --force --verify --verbose --sign "Developer ID Application: $SIGNING_IDENTITY" dist/Aesir-${{ env.VERSION }}.dmg
env:
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}'
- name: Notarize macOS App
if: matrix.config.os == 'macos-latest'
run: xcrun altool --notarize-app --primary-bundle-id "org.kryptokrona.aesir" \
--username "$APPLE_ID" --password "$APP_SPECIFIC_PASSWORD" \
--file dist/Aesir-${{ env.VERSION }}.dmg
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
- name: Staple Notarization
if: matrix.config.os == 'macos-latest'
run: xcrun stapler staple dist/Aesir-${{ env.VERSION }}.app
- name: Check artifacts --DEBUG--
run: ls dist
- name: Upload Release Asset Ubuntu
if: matrix.config.os == 'ubuntu-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/Aesir_${{ env.VERSION }}_amd64.deb
asset_name: Aesir_${{ env.VERSION }}_amd64.deb
asset_content_type: application/octet-stream
- name: Upload Release Asset macOS x64
if: matrix.config.os == 'macos-latest' && matrix.config.platform == 'x64'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/Aesir-${{ env.VERSION }}.dmg
asset_name: Aesir_${{ env.VERSION }}_x64.dmg
asset_content_type: application/octet-stream
- name: Upload Release Asset macOS arm64
if: matrix.config.os == 'macos-latest' && matrix.config.platform == 'arm64'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/Aesir-${{ env.VERSION }}-arm64.dmg
asset_name: Aesir_${{ env.VERSION }}_arm64.dmg
asset_content_type: application/octet-stream
- name: Upload Release Asset Windows
if: matrix.config.os == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/Aesir Setup ${{ env.VERSION }}.exe
asset_name: Aesir_Setup_${{ env.VERSION }}.exe
asset_content_type: application/x-msdownload