-
-
Notifications
You must be signed in to change notification settings - Fork 280
257 lines (221 loc) · 7.66 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
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: Publish
on:
create:
tags:
- v*
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-docker-hub:
runs-on: ubuntu-latest
steps:
- name: Retrieve tag
id: retrieve
run: |
DOCKER_IMAGE=sadeghhayeri/green-tunnel
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=tags::${TAGS}
- uses: actions/checkout@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
file: Dockerfile
push: true
tags: ${{ steps.retrieve.outputs.tags }},sadeghhayeri/green-tunnel:latest
publish-docker-hub-for-arm:
runs-on: ubuntu-latest
steps:
- name: Retrieve tag
id: retrieve
run: |
DOCKER_IMAGE=sadeghhayeri/green-tunnel
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
TAGS="${DOCKER_IMAGE}:arm-${VERSION}"
echo ::set-output name=tags::${TAGS}
- uses: actions/checkout@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Change Base Image
run: sed -i 's/mhart\/alpine-node:12/balenalib\/raspberry-pi-alpine-node/g' Dockerfile
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
file: Dockerfile
push: true
tags: ${{ steps.retrieve.outputs.tags }},sadeghhayeri/green-tunnel:arm-latest
platforms: linux/amd64,linux/armhf,linux/arm64
build-for-mac:
runs-on: macOS-latest
needs: [publish-npm]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Dependencies
working-directory: ./gui
run: npm ci
- name: Update GreenTunnel Core
working-directory: ./gui
run: npm install green-tunnel --save
- name: Fix GUI Naming
working-directory: ./gui
run: |
sed -i '' 's/green-tunnel-gui/green-tunnel/g' package.json
sed -i '' 's/green-tunnel-gui/green-tunnel/g' package-lock.json
- name: Generate new icons files
working-directory: ./gui
run: npm run generate-icons
- name: Build for MacOS
working-directory: ./gui
run: npm run package-mac
- name: Zip
working-directory: ./gui/release-builds/green-tunnel-darwin-x64
run: zip -r green-tunnel-macos.zip green-tunnel.app
- name: Save to Artifact
uses: actions/upload-artifact@v1
with:
name: builds
path: ./gui/release-builds/green-tunnel-darwin-x64/green-tunnel-macos.zip
build-for-windows:
runs-on: windows-latest
needs: [publish-npm]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- name: Update GreenTunnel Core
working-directory: ./gui
run: npm install green-tunnel --save
- name: Fix GUI Naming
working-directory: ./gui
run: |
powershell -Command "(gc package.json) -replace 'green-tunnel-gui', 'green-tunnel' | Out-File -encoding ASCII package.json"
powershell -Command "(gc package-lock.json) -replace 'green-tunnel-gui', 'green-tunnel' | Out-File -encoding ASCII package-lock.json"
- name: Generate new icons files
working-directory: ./gui
run: npm run generate-icons
- name: Build for Windows
working-directory: ./gui
run: npm run package-win
- name: Add Windows Installer
working-directory: ./gui
run: npm run windows-installer
- name: Save to Artifact
uses: actions/upload-artifact@v1
with:
name: builds
path: ./gui/release-builds/green-tunnel/windows-installer/green-tunnel-installer.exe
build-for-linux:
runs-on: ubuntu-latest
needs: [publish-npm]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Dependencies
working-directory: ./gui
run: |
npm ci
npm install -g electron-installer-debian
- name: Update GreenTunnel Core
working-directory: ./gui
run: npm install green-tunnel --save
- name: Fix GUI Naming
working-directory: ./gui
run: |
sed -i 's/green-tunnel-gui/green-tunnel/g' package.json
sed -i 's/green-tunnel-gui/green-tunnel/g' package-lock.json
- name: Generate new icons files
working-directory: ./gui
run: npm run generate-icons
- name: Build for Linux
working-directory: ./gui
run: npm run package-linux
- name: Add Linux Installer
working-directory: ./gui
run: npm run linux-installer
- name: Zip
working-directory: ./gui/release-builds
run: zip -r green-tunnel-debian.zip *.deb
- name: Save to Artifact
uses: actions/upload-artifact@v1
with:
name: builds
path: ./gui/release-builds/green-tunnel-debian.zip
new-release:
runs-on: ubuntu-latest
needs: [build-for-mac, build-for-windows, build-for-linux]
steps:
- name: Download Builds
uses: actions/download-artifact@v1
with:
name: builds
- name: Zip for Windows!
run: zip -r builds/green-tunnel-windows.zip builds/green-tunnel-installer.exe
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload MacOS Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: builds/green-tunnel-macos.zip
asset_name: green-tunnel-macos.zip
asset_content_type: application/app
- name: Upload Windows Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: builds/green-tunnel-windows.zip
asset_name: green-tunnel-windows.zip
asset_content_type: application/zip
- name: Upload Linux Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: builds/green-tunnel-debian.zip
asset_name: green-tunnel-debian.zip
asset_content_type: application/zip