-
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (119 loc) · 6.56 KB
/
publish.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
name: Publish release
on:
release: ~
workflow_dispatch: ~
env:
DEBUG: 'electron-installer-snap*'
jobs:
build:
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, windows-latest, macos-13, macos-14]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
# Follow https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
# to sign the application.
# You can create:
# The "Developer ID Application" certificate here: https://developer.apple.com/account/resources/certificates/list
# The provision profile and certificate here: https://developer.apple.com/account/resources/profiles/list
- name: Install the Apple certificate and provisioning profile
if: startsWith(matrix.os, 'macos')
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.APPLE_BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
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: 'electron packager: do not be quiet !' # See https://github.com/electron/forge/issues/3540
run: mv node_modules/@electron-forge/core/dist/api/package.js node_modules/@electron-forge/core/dist/api/package.quiet.js && sed 's/packageOpts.quiet = true/packageOpts.quiet = false/' node_modules/@electron-forge/core/dist/api/package.quiet.js > node_modules/@electron-forge/core/dist/api/package.js
# Issue with max opened file on arm macos
- name: 'change ulimit for arm macos'
if: startsWith(matrix.os, 'macos-14')
run: ulimit -n 999999
# Issue with max opened file on arm macos
- name: 'change launchctl limit for arm macos'
if: startsWith(matrix.os, 'macos-14')
run: sudo launchctl limit maxfiles 999999 999999
# snapcraft specific
- name: Setup LXD
uses: canonical/setup-lxd@main
if: startsWith(matrix.os, 'ubuntu')
- name: Install snapcraft for linux
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install snapcraft snapd
- name: install weird snapcraft dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo snap install gnome-42-2204 gnome-42-2204-sdk gtk-common-themes
- name: do not use "snapcraft.cfg" file
if: startsWith(matrix.os, 'ubuntu')
run: sed -i 's/if (!(await fs_extra_1.default.pathExists(snapcraftCfgPath)))/if (false \&\& !(await fs_extra_1.default.pathExists(snapcraftCfgPath)))/' node_modules/@electron-forge/publisher-snapcraft/dist/PublisherSnapcraft.js
- name: fix issue with Snapcraft path
if: startsWith(matrix.os, 'ubuntu')
run: sed -i 's/snapcraft = new Snapcraft();/snapcraft = new Snapcraft();await snapcraft.ensureInstalled();/' node_modules/@electron-forge/publisher-snapcraft/dist/PublisherSnapcraft.js
- name: fix issue with Snapcraft files
if: startsWith(matrix.os, 'ubuntu')
run: sed -i '97s/options/options, extraArgs/' node_modules/electron-installer-snap/src/snapcraft.js
- name: fix issue with Snapcraft files
if: startsWith(matrix.os, 'ubuntu')
run: sed -i '98s/options/options, extraArgs/' node_modules/electron-installer-snap/src/snapcraft.js
- name: fix electron-installer-snap
if: startsWith(matrix.os, 'ubuntu')
run: sed -i '67s/if (debug.enabled) {/if (command.startsWith('\''push'\'') \&\& debug.enabled) { args.push('\''--verbose'\'') } else if (debug.enabled) {/' node_modules/electron-installer-snap/src/snapcraft.js
- name: print file content
if: startsWith(matrix.os, 'ubuntu')
run: cat node_modules/electron-installer-snap/src/snapcraft.js
# node_modules/@electron-forge/maker-snap/dist/MakerSnap.js make function can access `arguments[0].forgeConfig.packagerConfig.name`
- name: fix executableName not handled properly (not getting the config parameter)
run: sed -i '40s/data.executableName/'\''tiana-tables'\'' || data.executableName/' node_modules/electron-installer-snap/src/launcher.js
# end snapcraft specific
- name: Sign & Publish Electron app
run: yarn publish
env:
# MacOS sign specific
APPLE_SIGN_ID: ${{ secrets.APPLE_SIGN_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# For every platform
GITHUB_TOKEN: ${{ github.token }}
- name: Publish to snapcraft store manually
if: startsWith(matrix.os, 'ubuntu')
working-directory: out/make/snap/x64/
run: |
unsquashfs tiana-tables*.snap && \
chmod 755 ./squashfs-root/tiana-tables/chrome-sandbox && \
snapcraft pack ./squashfs-root && \
snapcraft push --release=latest/edge --verbose tiana-tables_*.snap
env:
# for snapcraft
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}