-
Notifications
You must be signed in to change notification settings - Fork 6
61 lines (59 loc) · 2.08 KB
/
build.yml
File metadata and controls
61 lines (59 loc) · 2.08 KB
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
name: Build
on:
push:
pull_request:
jobs:
build:
runs-on: windows-2022
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: HMCL-Dev/HMCL
ref: main
path: HMCL-Build
- name: Get short SHA
run: echo "SHORT_SHA=$("${{ github.sha }}".SubString(0, 7))" >> $env:GITHUB_ENV
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x86
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-package: 'jdk+fx'
- name: Build HMCLauncher
run: |
cmake -A Win32 -B build
cmake --build build --config Release
- name: Create checksum file
run: Out-File -InputObject (Get-FileHash -Path build\Release\HMCLauncher.exe -Algorithm SHA256).Hash.ToLower() -FilePath build\Release\HMCLauncher.exe.sha256 -NoNewline
- name: Build HMCL
run: |
$env:HMCL_LAUNCHER_EXE="$env:GITHUB_WORKSPACE\build\Release\HMCLauncher.exe"
Set-Location "$env:GITHUB_WORKSPACE\HMCL-Build"
.\gradlew makeExecutables --no-daemon
- name: Copy Artifacts
run: |
New-Item -Type Directory -Path Artifacts
Copy-Item -Path HMCL-Build\HMCL\build\libs\*.exe -Destination Artifacts
Copy-Item -Path HMCL-Build\HMCL\build\libs\*.exe.sha256 -Destination Artifacts
Copy-Item -Path build\Release\HMCLauncher.exe -Destination Artifacts
Copy-Item -Path build\Release\HMCLauncher.exe.sha256 -Destination Artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: HMCLauncher-${{ env.SHORT_SHA }}
path: |
Artifacts
- name: Create release
if: ${{ github.ref_type == 'tag' }}
uses: softprops/action-gh-release@v2
with:
files: |
build/Release/HMCLauncher.exe
build/Release/HMCLauncher.exe.sha256