-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (89 loc) · 3.86 KB
/
build-and-release.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
name: Build and Release EXE and APK
on:
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
# Checkout the repository code
- name: Checkout code
uses: actions/checkout@v3
# Set up .NET SDK
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Clear NuGet Cache
run: dotnet nuget locals all --clear
- name: Build Model
run: dotnet publish ModelA/ModelA.csproj -c Release -r win-x86 --self-contained -o ./Release
- name: Build Gene dll
run: dotnet publish GeneA/GeneA.csproj -c Release -r win-x86 --self-contained -o ./Release
# Build the EXE in Release mode
- name: Build EXE
run: dotnet publish GeneA.Desktop/GeneA.Desktop.csproj -c Release -r win-x86 --self-contained -o ./Desktop/Release
- name: Download dotnet runtime
run: |
Invoke-WebRequest -Uri "https://download.visualstudio.microsoft.com/download/pr/3980ab0a-379f-44a0-9be6-eaf74c07a3b3/bd1cc6107ff3d8fe0104d30f01339b74/dotnet-runtime-8.0.7-win-x64.exe" -OutFile "./DesktopInstall/dotnet-runtime-8.0.7-win-x64.exe"
# Install NSIS
- name: Install NSIS
run: choco install nsis
# Create the EXE installer using NSIS
- name: Create EXE Installer
run: makensis DesktopInstall/GeneInstallerScript.nsi
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Install Android SDK
run: |
choco install android-sdk
choco install android-ndk
echo "export ANDROID_HOME=C:/Program Files (x86)/Android/android-sdk" >> $GITHUB_ENV
echo "export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/30.0.3:$PATH" >> $GITHUB_ENV
- name: Install Android Workloads
run: dotnet workload install android
# Build the APK in Release mode
- name: Build APK
run: dotnet publish GeneA.Android/GeneA.Android.csproj -c Release -o ./Android/Release/apk
- name: Download Keystore
run: |
[System.IO.File]::WriteAllBytes("./Android/Release/key.jks", [Convert]::FromBase64String("${{ secrets.ANDROID_KEYSTORE }}"))
# Sign the APK (if needed)
- uses: ilharp/sign-android-release@v1 # Or use @nightly
name: Sign app APK
id: sign_app
with:
releaseDir: ./Android/Release/apk
signingKey: ${{ secrets.ANDROID_KEYSTORE }}
keyAlias: gene
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
buildToolsVersion: 33.0.0
# Create a new GitHub release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.0.${{ github.run_number }} # Auto-increment the version
release_name: Release v1.0.${{ github.run_number }}
draft: false
prerelease: false
# Upload the EXE installer to the GitHub release
- name: Upload EXE to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DesktopInstall/Gene Installer.exe
asset_name: Gene Installer.exe
asset_content_type: application/octet-stream
# Upload the signed APK to the GitHub release
- name: Upload APK to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Android/Release/apk/com.jooworks.Gene.apk
asset_name: com.jooworks.Gene.apk
asset_content_type: application/vnd.android.package-archive