-
Notifications
You must be signed in to change notification settings - Fork 13
123 lines (108 loc) · 5.15 KB
/
desktop-release.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
name: "Release"
# Build the desktop app with code from ente-io/ente and create/update a release.
#
# For more details, see `docs/release.md` in ente-io/ente.
on:
# Trigger manually or `gh workflow run desktop-release.yml --source=foo`.
workflow_dispatch:
inputs:
source:
description: "Branch (ente-io/ente) to build"
type: string
schedule:
# Run everyday at ~8:00 AM IST (except Sundays).
# See: [Note: Run workflow every 24 hours]
#
- cron: "45 2 * * 1-6"
push:
# Run when a tag matching the pattern "vd.d.d" is pushed. In particular,
# this excludes the "-beta" tags.
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
release:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: desktop
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# If triggered by a tag, checkout photosd-$tag from the source
# repository. Otherwise checkout $source (default: "main").
repository: ente-io/ente
ref:
"${{ startsWith(github.ref, 'refs/tags/v') &&
format('photosd-{0}', github.ref_name) || ( inputs.source
|| 'main' ) }}"
submodules: recursive
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Increase yarn timeout
# `yarn install` times out sometimes on the Windows runner,
# resulting in flaky builds.
run: yarn config set network-timeout 900000 -g
- name: Install dependencies
run: yarn install
- name: Create universal ffmpeg binaries for macOS
if: startsWith(matrix.os, 'macos')
# Currently, the ffmpeg-static binaries are not universal (Not
# their fault, we thank them for their useful package, the issue
# is that there don't seem to be well known upstream sources that
# provide a universal binary).
#
# As a workaround, we invoke ffmpeg-static twice to download both
# the Intel and ARM binaries, and combine them into a single
# universal binary using lipo.
#
# Note that the yarn install will run again, as part of the
# "build:ci" step, so we're relying on ffmpeg-static install.js's
# behaviour of not overwriting the existing file named `ffmpeg`.
run: |
rm -f node_modules/ffmpeg-static/ffmpeg
npm_config_arch=arm64 yarn add --check-files ffmpeg-static
mv node_modules/ffmpeg-static/ffmpeg ffmpeg-arm64
npm_config_arch=x64 yarn add --check-files ffmpeg-static
mv node_modules/ffmpeg-static/ffmpeg ffmpeg-x64
lipo -create ffmpeg-arm64 ffmpeg-x64 -output node_modules/ffmpeg-static/ffmpeg
rm ffmpeg-arm64 ffmpeg-x64
file node_modules/ffmpeg-static/ffmpeg # print what we ended up with
- name: Install libarchive-tools for pacman build
if: startsWith(matrix.os, 'ubuntu')
# See:
# https://github.com/electron-userland/electron-builder/issues/4181
run: sudo apt-get install libarchive-tools
- name: Build
uses: ente-io/action-electron-builder@eff78a1d33bdab4c54ede0e5cdc71e0c2cf803e2
with:
package_root: desktop
build_script_name: build:ci
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.GITHUB_TOKEN }}
# Passes `--publish always` to electron-builder
release: true
mac_certs: ${{ secrets.MAC_CERTS }}
mac_certs_password: ${{ secrets.MAC_CERTS_PASSWORD }}
env:
# macOS notarization credentials key details
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD:
${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# Default is "draft", but since our nightly builds update
# existing pre-releases, set this to "prerelease".
EP_PRE_RELEASE: true
# By default, electron-builder does not update releases that
# were more than 2 hours ago. Override this to allow us to
# continually update our nightly pre-releases.
EP_GH_IGNORE_TIME: true
# Workaround recommended in
# https://github.com/electron-userland/electron-builder/issues/3179
USE_HARD_LINKS: false