-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.47 KB
/
main.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
name: Build and Upload .NET Project
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, ubuntu-24.04 ] # 24.04 is for android
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # Specify your .NET version here
- name: Set up JDK 17
if: matrix.os == 'ubuntu-24.04'
# 24.04 is android
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
if: matrix.os == 'ubuntu-24.04'
# 24.04 is android
uses: android-actions/setup-android@v3
- name: Restore dependencies
run: |
dotnet workload restore
- name: Build
if: matrix.os != 'ubuntu-24.04'
# 24.04 is android
run: dotnet build VowelCountApp/VowelCountApp.Desktop --configuration Release #--no-restore
- name: Publish
if: matrix.os != 'ubuntu-24.04'
# 24.04 is android
run: dotnet publish VowelCountApp/VowelCountApp.Desktop --configuration Release --output ./output
- name: Build and Publish For android
if: matrix.os == 'ubuntu-24.04'
# 24.04 is android
run: |
dotnet build VowelCountApp/VowelCountApp.Android --configuration Release
dotnet publish VowelCountApp/VowelCountApp.Android --configuration Release --output ./output
- name: Zip folder on Linux
if: matrix.os == 'ubuntu-latest'
run: zip -r VowelCountApp-${{ matrix.os }}-${{ github.run_id }}.zip ./output/*
- name: Zip folder on Windows
if: matrix.os == 'windows-latest'
run: powershell -Command "Compress-Archive -Path 'output/*' -DestinationPath 'VowelCountApp-${{ matrix.os }}-${{ github.run_id }}.zip'"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dotnet-artifacts-${{ matrix.os }}
path: ./output
- name: Upload to Release
uses: softprops/action-gh-release@v1
with:
files: |
VowelCountApp-${{ matrix.os }}-${{ github.run_id }}.zip
output/*.apk
#android doesn't need Zipping, so direct upload
name: VowelCountApp-${{ github.run_id }}
tag_name: ${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}