Skip to content

Commit 5dd8c00

Browse files
authored
Create Build.yml
1 parent ca5baf7 commit 5dd8c00

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/Build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build .NET MAUI App
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger build on push to main branch
7+
pull_request:
8+
branches:
9+
- main # Trigger build on pull request to main branch
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest # Use the latest Ubuntu runner
14+
15+
strategy:
16+
matrix:
17+
platform: [android, ios, maccatalyst, windows] # Matrix build for different platforms
18+
19+
steps:
20+
- name: Check out the code
21+
uses: actions/checkout@v3
22+
23+
- name: Set up .NET
24+
uses: actions/setup-dotnet@v3
25+
with:
26+
dotnet-version: '8.0.x' # .NET version
27+
28+
- name: Install dependencies
29+
run: |
30+
dotnet restore # Restore project dependencies
31+
32+
- name: Build project
33+
run: |
34+
dotnet build --configuration Release --target ${{ matrix.platform }} --no-restore # Build project for target platform
35+
36+
- name: Publish for ${{ matrix.platform }}
37+
run: |
38+
dotnet publish --configuration Release --output ./publish --target ${{ matrix.platform }} --no-restore # Publish the app for the selected platform
39+
40+
- name: Archive artifacts
41+
if: success() # Archive the build artifacts
42+
uses: actions/upload-artifact@v3
43+
with:
44+
name: ${{ matrix.platform }}-output
45+
path: ./publish

0 commit comments

Comments
 (0)