-
-
Notifications
You must be signed in to change notification settings - Fork 38
85 lines (77 loc) · 2.85 KB
/
build.yaml
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
name: Publish
on:
release:
types: [published]
jobs:
release:
name: Release
strategy:
matrix:
kind: ['macOS', 'windows', 'linux']
include:
- kind: macOS
os: macos-latest
target: osx
arm: true
- kind: windows
os: windows-latest
target: win
arm: false
- kind: linux
os: ubuntu-latest
target: linux
arm: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 9.0.100
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="App-$tag-${{ matrix.target }}"
trim="True"
if [ "${{ matrix.target }}" == "linux" ]; then
trim="False"
fi
# Build everything
dotnet publish pupdate.csproj -r ${{ matrix.target }}-x64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly -p:PublishTrimmed=$trim -p:TrimMode=partial
if ${{ matrix.arm }}; then
mv ${release_name}/pupdate ${release_name}/pupdate_x64
dotnet publish pupdate.csproj -r ${{ matrix.target }}-arm64 --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly -p:PublishTrimmed=$trim -p:TrimMode=partial
mv ${release_name}/pupdate ${release_name}/pupdate_arm64
if [ "${{ matrix.target }}" == "linux" ]; then
dotnet publish pupdate.csproj -r ${{ matrix.target }}-arm --self-contained true -c Release -o "$release_name" --consoleloggerparameters:ErrorsOnly -p:PublishTrimmed=$trim -p:TrimMode=partial
mv ${release_name}/pupdate ${release_name}/pupdate_arm32
fi
fi
# Pack files
if [ "${{ matrix.target }}" == "win" ]; then
# Pack to zip for Windows
7z a -tzip "pupdate_win.zip" "./${release_name}/pupdate.exe"
elif [ "${{ matrix.target }}" == "osx" ]; then
cd $release_name
lipo -create -output pupdate pupdate_arm64 pupdate_x64
rm pupdate_arm64
rm pupdate_x64
zip "../pupdate_mac.zip" "pupdate"; cd ..;
else
cd $release_name
mv pupdate_x64 pupdate
zip "../pupdate_linux.zip" "pupdate"
zip "../pupdate_linux_arm64.zip" "pupdate_arm64"
zip "../pupdate_linux_arm32.zip" "pupdate_arm32"
cd ..
fi
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "pupdate*.zip"
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}