-
Notifications
You must be signed in to change notification settings - Fork 19
234 lines (219 loc) Β· 9.04 KB
/
master.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Deploy-to-fdconfig:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v1
with:
# Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0
node-version: 16 # optional, default is 10.x
- name: npm ci
# You may pin to the exact commit or the version.
# uses: EgorDm/gha-yarn-node-cache@5e3a518810b21a8e0e1d236a3db83a18cfc1be9e
run: npm ci
- name: build
run: CI=false npm run build
- name: Deploy
# You may pin to the exact commit or the version.
# uses: SamKirkland/FTP-Deploy-Action@da0d77ff390a13097c60f9b9eb954e503a480d97
uses: easingthemes/[email protected]
with:
REMOTE_HOST: "78.47.56.63"
REMOTE_USER: githubactions
TARGET: "/var/www/fdconfig/"
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# The local folder to copy, defaults to root project folder
SOURCE: "build/"
- name: Cloudflare Purge Cache
uses: jakejarvis/[email protected]
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
create-tauriconfjson:
outputs:
version: ${{ steps.getversion.outputs.PACKAGE_VERSION }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: get version develop
# id: getversion
# shell: bash
# run: echo "::set-output name=PACKAGE_VERSION::$(date -u +%y.%-m.%d)"
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: get version develop
id: getversion
shell: bash
run: echo "::set-output name=PACKAGE_VERSION::$(node -p "require('./package.json').version")"
- uses: actions/upload-artifact@v3
with:
name: tauri.conf.json
path: src-tauri/tauri.conf.json
build-tauri:
needs: create-tauriconfjson
outputs:
macsig: ${{ steps.readmacsig.outputs.signature }}
winsig: ${{ steps.readwinsig.outputs.signature }}
linuxsig: ${{ steps.readlinuxsig.outputs.signature }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
src-tauri/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-
- name: delete previous bundles
run: rm -rf src-tauri/target/release/bundle
shell: bash
- uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-node-
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf libudev-dev libgssapi-krb5-2 libxdo-dev
- name: remove tauri.conf.json
shell: bash
run: rm -f src-tauri/tauri.conf.json
- name: acquire modified tauri.conf.json
uses: actions/download-artifact@v3
with:
name: tauri.conf.json
path: src-tauri
- name: install app dependencies and build it
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_UPDATER_KEY }}
CI: false
run: npm ci && npm run tauri:build
- name: read signatures
id: readmacsig
if: matrix.platform == 'macos-latest'
run: |
echo "::set-output name=signature::$(cat src-tauri/target/release/bundle/macos/freedeck-configurator.app.tar.gz.sig)"
- name: read signatures
id: readwinsig
if: matrix.platform == 'windows-latest'
shell: bash
run: |
echo "::set-output name=signature::$(cat src-tauri/target/release/bundle/msi/freedeck-configurator_${{ needs.create-tauriconfjson.outputs.version }}_x64_en-US.msi.zip.sig)"
- name: read signatures
id: readlinuxsig
if: matrix.platform == 'ubuntu-latest'
run: |
echo "::set-output name=signature::$(cat src-tauri/target/release/bundle/appimage/freedeck-configurator_${{ needs.create-tauriconfjson.outputs.version }}_amd64.AppImage.tar.gz.sig)"
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: src-tauri/target/release/bundle/**/*
upload-release-artifact:
needs:
- build-tauri
- create-tauriconfjson
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: debug
run: ls -R
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ubuntu-latest/appimage/*.AppImage.tar.gz,ubuntu-latest/appimage/*.AppImage.tar.gz.sig,ubuntu-latest/deb/*.deb,ubuntu-latest/deb/*.deb,macos-latest/dmg/*.dmg,macos-latest/macos/freedeck-configurator.app.tar.gz,macos-latest/macos/freedeck-configurator.app.tar.gz.sig,windows-latest/msi/*.msi.zip,windows-latest/msi/*.msi.zip.sig
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ needs.create-tauriconfjson.outputs.version }}"
deploy-update-json:
needs:
- build-tauri
- create-tauriconfjson
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create timestamp
run: echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: create-json
id: create-json
uses: jsdaniell/[email protected]
with:
name: "updater.json"
json: |
{
"version": "${{ needs.create-tauriconfjson.outputs.version }}",
"pub_date": "${{ env.NOW }}",
"platforms": {
"darwin-x86_64": {
"url": "https://github.com/FreeYourStream/freedeck-configurator/releases/download/${{ needs.create-tauriconfjson.outputs.version }}/freedeck-configurator.app.tar.gz",
"signature": "${{ needs.build-tauri.outputs.macsig }}"
},
"windows-x86_64": {
"url": "https://github.com/FreeYourStream/freedeck-configurator/releases/download/${{ needs.create-tauriconfjson.outputs.version }}/freedeck-configurator_${{ needs.create-tauriconfjson.outputs.version }}_x64_en-US.msi.zip",
"signature": "${{ needs.build-tauri.outputs.winsig }}"
},
"linux-x86_64": {
"url": "https://github.com/FreeYourStream/freedeck-configurator/releases/download/${{ needs.create-tauriconfjson.outputs.version }}/freedeck-configurator_${{ needs.create-tauriconfjson.outputs.version }}_amd64.AppImage.tar.gz",
"signature": "${{ needs.build-tauri.outputs.linuxsig }}"
}
}
}
dir: "src-tauri/"
- name:
Deploy
# You may pin to the exact commit or the version.
# uses: SamKirkland/FTP-Deploy-Action@da0d77ff390a13097c60f9b9eb954e503a480d97
uses: easingthemes/[email protected]
with:
REMOTE_HOST: "78.47.56.63"
REMOTE_USER: githubactions
TARGET: "/var/www/fdconfig/updater.json"
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# The local folder to copy, defaults to root project folder
SOURCE: "src-tauri/updater.json"
Notify-Discord:
needs:
- Deploy-to-fdconfig
- create-tauriconfjson
runs-on: ubuntu-latest
steps:
- name: Actions for Discord
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_URL_CONF_STABLE }}
with:
args: "πππ A new stable Configurator/App has been released (${{ needs.create-tauriconfjson.outputs.version }}) https://fdconfig.freeyourstream.com πππ"