-
Notifications
You must be signed in to change notification settings - Fork 11
203 lines (167 loc) · 6.11 KB
/
build.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
name: Build and Publish
on:
push:
branches: [ main ]
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.os }})
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
extension: ".zip"
runtime: "win-x64"
- os: ubuntu-latest
extension: ".tar.gz"
runtime: "linux-x64"
- os: macos-latest
runtime: "osx-x64"
extension: ".zip"
node_version: [22]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PROJECT_NAME: "Angor"
SOLUTION_PATH: "src/Angor.sln"
PROJECT_PATH: "src/Angor/Server/Angor.Server.csproj"
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- name: Variables
run: |
echo VERSION=$(npm run version --silent) >> $GITHUB_ENV
shell: bash
- name: Publish
run: dotnet publish -r ${{matrix.runtime}} /p:Version=${{ env.VERSION }}.${{ github.run_number }} -v m -o publish ${{env.PROJECT_PATH}}
env:
matrix.runtime: ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}
- name: Run Tests
continue-on-error: true
run: dotnet test --configuration Release -r ${{matrix.runtime}} --verbosity normal ${{env.SOLUTION_PATH}}
env:
matrix.runtime: ${{ matrix.os == 'windows-latest' && 'win-x64' || matrix.os == 'ubuntu-latest' && 'linux-x64' || 'osx-x64' }}
- name: Zip Release
run: |
cd publish
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a -tzip "../angor-web-${{ env.VERSION }}-${{ matrix.runtime }}.zip" .
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
zip -r "../angor-web-${{ env.VERSION }}-${{ matrix.runtime }}.zip" .
else
zip -r "../angor-web-${{ env.VERSION }}-${{ matrix.runtime }}.zip" .
fi
shell: bash
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: angor-web-${{ env.VERSION }}-${{ matrix.runtime }}.zip
path: angor-web-${{ env.VERSION }}-${{ matrix.runtime }}.zip
- name: Install Rust (Stable)
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev webkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsoup-3.0-dev libjavascriptcoregtk-4.1-dev
- name: Install and build
run: |
npm install
npm run tauri:build
- name: Rename Linux files
if: matrix.os == 'ubuntu-latest'
run: |
mv src-tauri/target/release/bundle/appimage/Angor_${{ env.VERSION }}_amd64.AppImage src-tauri/target/release/bundle/appimage/angor-desktop-${{ env.VERSION }}-linux-amd64.AppImage
- name: Rename Mac files
if: matrix.os == 'macos-latest'
run: |
mv src-tauri/target/release/bundle/dmg/Angor_${{ env.VERSION }}_aarch64.dmg src-tauri/target/release/bundle/dmg/angor-desktop-${{ env.VERSION }}-mac-aarch64.dmg
- name: Rename Mac files
if: matrix.os == 'windows-latest'
run: |
mv src-tauri/target/release/bundle/msi/Angor_${{ env.VERSION }}_x64_en-US.msi src-tauri/target/release/bundle/msi/angor-desktop-${{ env.VERSION }}-win-x64.msi
- uses: actions/upload-artifact@v4
name: Upload Linux
if: matrix.os == 'ubuntu-latest'
with:
name: angor-desktop-${{ env.VERSION }}-linux-amd64.AppImage
path: src-tauri/target/release/bundle/appimage/angor-desktop-${{ env.VERSION }}-linux-amd64.AppImage
- uses: actions/upload-artifact@v4
name: Upload Mac
if: matrix.os == 'macos-latest'
with:
name: angor-desktop-${{ env.VERSION }}-mac-aarch64.dmg
path: src-tauri/target/release/bundle/dmg/angor-desktop-${{ env.VERSION }}-mac-aarch64.dmg
- uses: actions/upload-artifact@v4
name: Upload Windows
if: matrix.os == 'windows-latest'
with:
name: angor-desktop-${{ env.VERSION }}-win-x64.msi
path: src-tauri\target\release\bundle\msi\angor-desktop-${{ env.VERSION }}-win-x64.msi
create-release:
name: Publish (Release)
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Variables
run: |
echo VERSION=$(npm run version --silent) >> $GITHUB_ENV
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List Files
run: ls -R
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: Angor (${{ env.VERSION }})
draft: true
files: |
artifacts/*
deploy-release:
name: Deploy (Test)
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Variables
run: |
echo VERSION=$(npm run version --silent) >> $GITHUB_ENV
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List Files
run: ls -R
- name: Unzip Artifact
run: |
unzip artifacts/angor-web-${{ env.VERSION }}-linux-x64.zip -d dist
shell: bash
- name: Copy index.html to 404.html
run: cp dist/wwwroot/index.html dist/wwwroot/404.html
- name: Add .nojekyll file
run: touch dist/wwwroot/.nojekyll
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: main
folder: dist/wwwroot
repository-name: block-core/angor-test
token: ${{ secrets.ANGOR_DEPLOY_TOKEN }}