-
Notifications
You must be signed in to change notification settings - Fork 2
202 lines (182 loc) · 6.67 KB
/
publish-search-app.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
192
193
194
195
196
197
198
199
200
201
202
name: Publish Search App
on:
workflow_dispatch:
push:
tags:
- "v*"
env:
CARGO_HOME: /opt/cache/cargo
CONAN_HOME: /opt/cache/conan
COURSIER_HOME: /opt/cache/coursier
IVY_HOME: /opt/cache/ivy2
NPM_CONFIG_CACHE: /opt/cache/npm
SBT_HOME: /opt/cache/sbt
XDG_CONFIG_HOME: /opt/cache/pnpm
jobs:
build:
name: Publish
strategy:
matrix:
settings:
- runner: harana-dev-mac-x86
target: x86_64-apple-darwin
bundles: app,dmg
os: darwin
arch: x86_64
- runner: harana-dev-mac-arm64
target: aarch64-apple-darwin
bundles: app,dmg
os: darwin
arch: aarch64
# - host: windows-latest
# target: x86_64-pc-windows-msvc
# bundles: msi
# os: windows
# arch: x86_64
# - host: windows-latest
# target: aarch64-pc-windows-msvc
- runner: harana-dev-linux
target: x86_64-unknown-linux-gnu
bundles: deb,appimage
os: linux
arch: x86_64
# - runner: harana-dev-linux
# target: aarch64-unknown-linux-gnu
# bundles: deb
runs-on: ${{ matrix.settings.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: search
- name: Checkout search engine repo
uses: actions/checkout@v4
with:
repository: harana/search-engine
path: search-engine
token: ${{ secrets.READ_REPOSITORIES_TOKEN }}
- name: Get Branch/Tag
id: ref
uses: frabert/[email protected]
with:
pattern: 'refs\/\w+\/(.*)'
string: ${{ github.ref }}d
replace-with: '$1'
- name: Get Short SHA
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 6
- name: Get Version
uses: haya14busa/action-cond@v1
id: version
with:
cond: ${{ contains(github.ref, 'tag') }}
if_true: ${{ steps.ref.outputs.replaced }}
if_false: ${{ steps.ref.outputs.replaced }}-${{ steps.short-sha.outputs.sha }}
- name: Install Apple API key
if: ${{ runner.os == 'macOS' }}
run: |
mkdir -p ~/.appstoreconnect/private_keys/
cd ~/.appstoreconnect/private_keys/
echo ${{ secrets.APPLE_API_KEY }} >> AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8.base64
base64 --decode -i AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8.base64 -o AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8
rm AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8.base64
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\spacedrive_target
New-Item -Path target -ItemType Junction -Value C:\spacedrive_target
- name: Populate Credentials
run: |
mkdir -p $SBT_HOME/1.0/plugins
if [ ! -f '$SBT_HOME/1.0/plugins/credentials.sbt' ]; then
cat <<EOF > $SBT_HOME/1.0/plugins/credentials.sbt
credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", "nadenf", System.getenv("GITHUB_TOKEN"))
EOF
fi
- name: Install Frontend Dependencies
run: |
cd search
pnpm install
- name: Build Frontend
run: |
rm -fr $COURSIER_HOME/cache/https/maven.pkg.github.com/harana/sbt-plugin
cd search
sbt \
-Divy.home=$IVY_HOME \
-Dsbt.boot.directory=$SBT_HOME/boot \
-Dsbt.coursier.home=$COURSIER_HOME \
-Dsbt.global.base=$SBT_HOME/1.0 \
-Dsbt.ivy.home=$IVY_HOME \
-Dsbt.repository.config=$SBT_HOME/repositories \
buildFrontend
env:
GITHUB_TOKEN: ${{ secrets.WRITE_PACKAGES_TOKEN }}
- name: Build Conan Libraries
run: |
cd search-engine
cargo update
conan profile detect || true
conan install --build=missing --build=ffmpeg/6.1 -of=build -d=full_deploy .
- name: Build Tauri
run: |
FFMPEG_PROJECT=`conan cache path --folder build ffmpeg/6.1:$(conan list "ffmpeg/6.1:*" | sed -n '7p' | tr -d ' ')`
export FFMPEG_DIR="${FFMPEG_PROJECT%?}p"
source /etc/profile
cd search && pnpm run css
cd src-tauri && cargo update
cd .. && pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }},updater
env:
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_PROVIDER_SHORT_NAME: ${{ secrets.APPLE_PROVIDER_SHORT_NAME }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
NODE_OPTIONS: "--max_old_space_size=8196"
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
- name: Publish Artifacts
uses: ./search/.github/actions/publish-artifacts
with:
os: ${{ matrix.settings.os }}
arch: ${{ matrix.settings.arch }}
target: ${{ matrix.settings.target }}
profile: release
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
name: Create Release
needs: build
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: '*/**'
- name: Notify Slack - Success
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_FOOTER: ""
SLACK_MESSAGE: "✅ harana-${{ github.event.repository.name }} | publish | ${{ steps.version.outputs.value }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_BUILDS_WEBHOOK }}
- name: Notify Slack - Failure
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_FOOTER: ""
SLACK_MESSAGE: "⛔️ harana-${{ github.event.repository.name }} | publish | ${{ steps.version.outputs.value }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_BUILDS_WEBHOOK }}
- name: Output Version
if: success()
run: |
echo ${{ steps.version.outputs.value }}