-
-
Notifications
You must be signed in to change notification settings - Fork 76
79 lines (68 loc) · 3.02 KB
/
BuildMacOS.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
name: Build PicView Avalonia on macOS
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
build:
runs-on: macos-latest
steps:
# Step 1: Checkout the code
- name: Checkout repository
uses: actions/checkout@v4
# Step 2: Setup .NET 9 SDK
- name: Setup .NET 9 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
# Step 3: Get version from Directory.Build.props using PowerShell
- name: Get version from Directory.Build.props
id: get-version
run: pwsh -File "${{ github.workspace }}/Build/Get-VersionInfo.ps1"
# Step 4 (x64): Publish x64 version
- name: Publish x64 version
run: |
dotnet publish src/PicView.MacOS/PicView.MacOS.csproj \
-c Release \
-r osx-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-o "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64"
# Step 5 (x64): Create MacOS app bundle for x64
- name: Create MacOS app bundle (x64)
run: |
mkdir -p "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64/PicView.app/Contents/MacOS"
cp -r "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64/*" \
"${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64/PicView.app/Contents/MacOS/"
# Step 6 (x64): Upload x64 artifact
- name: Upload x64 artifact
uses: actions/upload-artifact@v4
with:
name: PicView-v${{steps.get-version.outputs.version}}-osx-x64
path: ${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64
retention-days: 14
# Step 7 (arm64): Publish arm64 version
- name: Publish arm64 version
run: |
dotnet publish src/PicView.MacOS/PicView.MacOS.csproj \
-c Release \
-r osx-arm64 \
--self-contained true \
-p:PublishSingleFile=true \
-o "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64"
# Step 8 (arm64): Create MacOS app bundle for arm64
- name: Create MacOS app bundle (arm64)
run: |
mkdir -p "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app/Contents/MacOS"
cp -r "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/*" \
"${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app/Contents/MacOS/"
# Step 9 (arm64): Upload arm64 artifact
- name: Upload arm64 artifact
uses: actions/upload-artifact@v4
with:
name: PicView-v${{steps.get-version.outputs.version}}-osx-arm64
path: ${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64
retention-days: 14