-
Notifications
You must be signed in to change notification settings - Fork 5
139 lines (119 loc) · 5.21 KB
/
dotnet.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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build and Test
on:
push:
pull_request:
branches: [ "main" ]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
name: Build, Test, and Upload Builds (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Set VERSION variable from tag
shell: bash
run: echo "VERSION=0.0.0" >> $GITHUB_ENV
- name: Publish for Linux x64
if: matrix.os == 'ubuntu-latest'
run: dotnet publish -c Release -r linux-x64 --self-contained Refresher /p:Version=${VERSION}
- name: Publish for Linux ARM
if: matrix.os == 'ubuntu-latest'
run: dotnet publish -c Release -r linux-arm --self-contained Refresher /p:Version=${VERSION}
- name: Publish for Linux ARM64
if: matrix.os == 'ubuntu-latest'
run: dotnet publish -c Release -r linux-arm64 --self-contained Refresher /p:Version=${VERSION}
- name: Publish for Windows x64
if: matrix.os == 'windows-latest'
shell: bash
run: dotnet publish -c Release -r win-x64 --self-contained Refresher //p:Version=${VERSION}
- name: Publish for macOS x64
if: matrix.os == 'macos-latest'
shell: bash
run: dotnet publish -c Release -r osx-x64 --self-contained Refresher /p:Version=${VERSION}
- name: Publish for macOS ARM64
if: matrix.os == 'macos-latest'
shell: bash
run: dotnet publish -c Release -r osx-arm64 --self-contained Refresher /p:Version=${VERSION}
- name: Create macOS universal2 binary
if: matrix.os == 'macos-latest'
shell: bash
working-directory: Refresher/bin/Release/net8.0/
run: |
mkdir -p osx-universal2/publish/Refresher.app/Contents/MacOS
cp -r osx-arm64/publish/*.app/Contents/ osx-universal2/publish/Refresher.app/Contents/
for file in $(find osx-arm64/publish/*.app/Contents/MacOS); do
if [[ "$(file $file)" == *"Mach-O"* ]]; then
if [[ "$(lipo -archs $file)" != *"x86_64 arm64"* ]]; then
lipo -create osx-arm64/publish/*.app/Contents/MacOS/$(basename $file) osx-x64/publish/*.app/Contents/MacOS/$(basename $file) -output osx-universal2/publish/Refresher.app/Contents/MacOS/$(basename $file);
fi;
fi;
done
rm -rfv osx-universal2/publish/Refresher.app/Contents/MacOS/*.app
codesign -fs - --deep osx-universal2/publish/Refresher.app
# We need to tarball our macOS and Linux builds, since the ZIP files created by upload-artifact do not retain extended unix file permissions,
# which means the executable bit is lost, which is un-ideal for end users, who will hit weird errors (especially relating to code signing on macOS)
- name: 'Tar macOS universal2 build'
if: matrix.os == 'macos-latest'
working-directory: Refresher/bin/Release/net8.0/osx-universal2/publish/
run: tar -cvf ../../../../../../Refresher-macOS.tar *.app
- name: 'Tar Linux x64'
if: matrix.os == 'ubuntu-latest'
working-directory: Refresher/bin/Release/net8.0/linux-x64/publish/
run: tar -cvf ../../../../../../Refresher-x64.tar *
- name: 'Tar Linux ARM'
if: matrix.os == 'ubuntu-latest'
working-directory: Refresher/bin/Release/net8.0/linux-arm/publish/
run: tar -cvf ../../../../../../Refresher-arm.tar *
- name: 'Tar Linux ARM64'
if: matrix.os == 'ubuntu-latest'
working-directory: Refresher/bin/Release/net8.0/linux-arm64/publish/
run: tar -cvf ../../../../../../Refresher-arm64.tar *
- name: Upload Linux x64 build
if: matrix.os == 'ubuntu-latest'
uses: actions/[email protected]
with:
name: "Refresher for Linux x64"
path: "Refresher-x64.tar"
if-no-files-found: error
retention-days: 30
- name: Upload Linux ARM build
if: matrix.os == 'ubuntu-latest'
uses: actions/[email protected]
with:
name: "Refresher for Linux ARM"
path: "Refresher-arm.tar"
if-no-files-found: error
retention-days: 30
- name: Upload Linux ARM64 build
if: matrix.os == 'ubuntu-latest'
uses: actions/[email protected]
with:
name: "Refresher for Linux ARM64"
path: "Refresher-arm64.tar"
if-no-files-found: error
retention-days: 30
- name: Upload Windows x64 build
if: matrix.os == 'windows-latest'
uses: actions/[email protected]
with:
name: "Refresher for Windows x64"
path: "Refresher/bin/Release/net8.0-windows/win-x64/publish/"
if-no-files-found: error
retention-days: 30
- name: Upload macOS universal2 build
if: matrix.os == 'macos-latest'
uses: actions/[email protected]
with:
name: "Refresher for macOS universal2"
path: "Refresher-macOS.tar"
if-no-files-found: error
retention-days: 30