-
Notifications
You must be signed in to change notification settings - Fork 81
212 lines (183 loc) · 6.14 KB
/
damselfly-actions.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
name: DamselflyBuild
on:
push:
workflow_dispatch:
inputs:
git-ref:
description: Git Ref (Optional)
required: false
jobs:
build-desktop:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [universal, linux, windows]
include:
- target: windows
os: windows-latest
- target: linux
os: ubuntu-latest
- target: universal
os: macos-latest
steps:
- name: Clone Repository (latest)
uses: actions/checkout@v3
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v3
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 16
- name: Run Electron build
run: sh scripts/makedesktop.sh ${{ matrix.target }}
- name: Upload desktop builds for Docker build
uses: actions/upload-artifact@v3
with:
name: Desktop-Dist
path: Damselfly.Web.Client/wwwroot/desktop/*.*
retention-days: 5
build-server:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# FIX Package restore for MacOS
target: [windows, linux]
include:
- target: windows
os: ubuntu-latest
- target: linux
os: ubuntu-latest
# - target: mac
# os: macos-latest
steps:
- name: Clone Repository (latest)
uses: actions/checkout@v3
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v3
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Setup Dotnet Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100'
- name: Install WASM-Tools
run: dotnet workload install wasm-tools
- name: Run Dotnet Server Build
run: sh scripts/makeserver.sh ${{ matrix.target }}
- name: Upload server builds to artifacts
uses: actions/upload-artifact@v3
with:
name: Server-Dist
path: server/*.zip
retention-days: 5
build-docker:
needs: [build-server, build-desktop]
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [linux]
include:
- target: linux
os: ubuntu-latest
steps:
- name: Clone Repository (latest)
uses: actions/checkout@v3
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v3
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Read VERSION file
id: getversion
run: echo "::set-output name=version::$(cat VERSION)"
- name: Download Server Build
uses: actions/download-artifact@v2
with:
name: Server-Dist
path: server
- name: Unzip server into publish folder
run: |
mkdir publish
cd publish
unzip $GITHUB_WORKSPACE/server/damselfly-server-${{ matrix.target }}-*.zip
cd ..
- name: Validate Server artifacts
run: |
echo "Server artifacts:"
ls server
- name: Download Desktop Builds into wwwroot folder
uses: actions/download-artifact@v2
with:
name: Desktop-Dist
path: publish/wwwroot/desktop
- name: Validate Desktop artifacts
run: |
echo "Desktop artifacts:"
ls publish/wwwroot/desktop
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker for Dev (develop only)
if: github.ref == 'refs/heads/develop'
run: sh scripts/makedocker.sh
- name: Build Docker for Release (master only)
if: github.ref == 'refs/heads/master'
run: sh scripts/makedocker.sh master
- name: Create Release (master only)
id: create_release
if: github.ref == 'refs/heads/master'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.getversion.outputs.version }}
release_name: Release v${{ steps.getversion.outputs.version }}
body: |
Docker: docker pull webreaper/damselfly:${{ steps.getversion.outputs.version }}
draft: false
prerelease: false
- name: Download Desktop Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v3
with:
name: Desktop-Dist
path: Damselfly.Web.Client/wwwroot/desktop
- name: Download Server Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v3
with:
name: Server-Dist
path: server
- name: Upload Server Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: server/*.zip
asset_name: Server-Dist.zip
asset_content_type: application/zip
- name: Upload Desktop Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Damselfly.Web.Client/wwwroot/desktop/*.*
asset_name: Desktop-Dist.zip
asset_content_type: application/zip