-
Notifications
You must be signed in to change notification settings - Fork 109
172 lines (169 loc) · 6.14 KB
/
main.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
name: Publish Electron Binaries
on:
workflow_dispatch:
inputs:
job-to-run:
description: 'Job to run (leave empty to run all)'
required: false
default: ''
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_VERSION: 20
jobs:
build-electron-linux:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.job-to-run == 'build-electron-linux' || github.event.inputs.job-to-run == 'build-electron-snap' || github.event.inputs.job-to-run == '' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build UI
working-directory: ./packages/ui
run: |
npm ci
npm run build-desktop-electron
# - name: Install flatpak dependencies
# run: |
# sudo apt-get install -y flatpak-builder
# flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Build deb, rpm, flatpak
working-directory: ./packages/electron
run: |
npm ci
export DEBUG=@malept/flatpak-bundler # required to see flatpak build logs
npm run publish
build-electron-windows:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.job-to-run == 'build-electron-windows' || github.event.inputs.job-to-run == '' }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build UI
working-directory: ./packages/ui
run: |
npm ci
npm run build-desktop-electron
- name: Build windows installer
working-directory: ./packages/electron
run: |
npm ci
npm run publish
build-electron-mac:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.job-to-run == 'build-electron-mac' || github.event.inputs.job-to-run == '' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-14 is arm64, macos-13 is x86_64 (so we get builds for both architectures)
# see https://github.com/actions/runner-images#available-images for more info
os: [macos-14, macos-13]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build UI
working-directory: ./packages/ui
run: |
npm ci
npm run build-desktop-electron
- name: Add macOS certs
run: chmod +x scripts/add-osx-cert.sh && ./scripts/add-osx-cert.sh
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
- name: Build macos binaries
working-directory: ./packages/electron
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
npm ci
npm run publish
build-electron-snap:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.job-to-run == 'build-electron-snap' || github.event.inputs.job-to-run == '' }}
needs: [build-electron-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build UI
working-directory: ./packages/ui
run: |
npm ci
npm run build-desktop-electron
- name: Build snap package
working-directory: ./packages/electron
run: |
npm ci
npm run build-snap
- name: Install Snapcraft
run: |
sudo apt-get install snapd
sudo snap install snapcraft --classic
- name: Set up Snap Store credentials & publish snap package
run: |
echo "${{ secrets.SNAP_STORE_TOKEN }}" | base64 -d > credentials.snapcraft
export SNAPCRAFT_STORE_CREDENTIALS=$(cat credentials.snapcraft)
snapcraft push --release=candidate ./packages/electron/dist/*.snap
- name: Set asset name
run: echo "SNAP_FILE_NAME=$(basename $(ls ./packages/electron/dist/*.snap))" >> $GITHUB_ENV
- name: Upload snap to GitHub release
run: |
node scripts/upload-file-to-latest-draft-release.js ./packages/electron/dist/${{ env.SNAP_FILE_NAME }}
build-docker-image:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.job-to-run == 'build-docker-image' || github.event.inputs.job-to-run == '' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Build and tag docker image
working-directory: .
run: |
docker build -t flawiddsouza/restfox:${{ env.VERSION }} -t flawiddsouza/restfox:latest .
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish docker image
run: |
docker push --all-tags flawiddsouza/restfox
update-release-notes:
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.job-to-run == '' }}
needs: [build-electron-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Generate & Update Release Notes
run: |
node scripts/update-release-notes.js