Skip to content

Commit

Permalink
Update script and workflow, code cleanup, ready for release
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-r-elp committed Jul 10, 2024
1 parent cae1b93 commit e829260
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 39 deletions.
40 changes: 8 additions & 32 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:

env:
module_id: ClockMod
BSVersion: 1.35.0_8016709773 # TODO: Remove usage of this variable
ndkname: android-ndk-r25 # TODO: Is this variable still used?

jobs:
build:
Expand All @@ -25,34 +23,12 @@ jobs:

- uses: seanmiddleditch/gha-setup-ninja@v3

#- name: Install Powershell
# run: sudo apt-get install -y powershell

- name: Get the tag name
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

#- name: Cache Android NDK
# id: cache-ndk
# uses: actions/cache@v2
# env:
# cache-name: cache-ndk
# with:
# path: ndk
# key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.ndkname }}
# restore-keys: |
# ${{ runner.os }}-${{ env.cache-name }}-${{ env.ndkname }}

#- name: Install Android NDK
# if: steps.cache-ndk.outputs.cache-hit != 'true'
# run: |
# wget -q -O ndk.zip https://dl.google.com/android/repository/${ndkname}-linux-x86_64.zip
# unzip -q ndk.zip
# mv ${ndkname} ndk

#- name: Create ndkpath.txt
# run: |
# cd ndk
# pwd > ${GITHUB_WORKSPACE}/ndkpath.txt
- name: Get BSVersion
shell: pwsh
echo "BSVersion=$((Get-Content ./mod.template.json -Raw | ConvertFrom-Json).packageVersion)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Create ndkpath.txt
run: |
Expand Down Expand Up @@ -85,8 +61,9 @@ jobs:
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-${{ env.cache-name }}
- name: QPM Restore
- name: QPM Set Version & Restore
run: |
./QPM/qpm package edit --version ${{ env.version }}
./QPM/qpm restore
- name: Check dependency Folders
Expand All @@ -105,8 +82,7 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}
./QPM/qpm package edit --version ${{ env.version }}
./QPM/qpm qmod build
pwsh -Command ./build.ps1 --actions
pwsh -Command ./build.ps1 -actions
- name: Get Library Name
id: libname
Expand All @@ -119,14 +95,14 @@ jobs:
- name: Package QMOD
run: |
cd ${GITHUB_WORKSPACE}
pwsh -Command ./buildQMOD.ps1 -package
./QPM/qpm qmod zip -i ./build/ -i ./extern/libs/ ${module_id}_${version}.qmod
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.module_id }} ${{ env.version }} for Beat Saber ${{ env.BSVersion }}
files: |
./${{ env.module_id }}.qmod
./${{ env.module_id }}_${{ env.version }}.qmod
body_path: ./rl-notes.md
draft: true

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/buildMod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ on:

env:
module_id: ClockMod
version: 1.8.2-Dev.${{ github.run_number }}
BSVersion: 1.35.0_8016709773

jobs:
Expand All @@ -35,6 +34,11 @@ jobs:
submodules: true
lfs: true

- name: Get Version
shell: pwsh
run: |
$branchParts = '${{ github.ref_name }}'.Split('/'); $branchMain = $branchParts[0]; if ($branchParts[0] -match "^\d+$") { $branchMain = 'pr'; $branchSub = "$($branchParts[0])." } elseif ($branchParts.Length -eq 2) { $branchSub = "$($branchParts[1].Replace('.', '-'))." }; echo "version=$((Get-Content ./qpm.shared.json -Raw | ConvertFrom-Json).config.info.version.Split('-')[0])-$($branchMain).${{ github.run_number }}+$($branchSub)ra${{ github.run_attempt }}.$($env:GITHUB_SHA.Substring(0, 7))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- uses: seanmiddleditch/gha-setup-ninja@v3

- name: Create ndkpath.txt
Expand Down Expand Up @@ -89,7 +93,7 @@ jobs:
cd ${GITHUB_WORKSPACE}
./QPM/qpm package edit --version ${{ env.version }}
./QPM/qpm qmod build
pwsh -Command ./build.ps1 --actions
pwsh -Command ./build.ps1 -actions
- name: Get Library Name
id: libname
Expand Down
18 changes: 15 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
Param (
[Parameter(Mandatory=$false, HelpMessage="The version the mod should be compiled with")][Alias("ver")][string]$Version, # Currently not used
[Parameter(Mandatory=$false, HelpMessage="Switch to create a clean compilation")][Alias("rebuild")][Switch]$clean,
[Parameter(Mandatory=$false, HelpMessage="To create a release build")][Alias("publish")][Switch]$release,
[Parameter(Mandatory=$false, HelpMessage="To create a github actions build, assumes specific Environment variables are set")][Alias("github-build")][Switch]$actions,
[Parameter(Mandatory=$false, HelpMessage="To create a debug build (Does not strip other libs)")][Alias("debug-build")][Switch]$debugbuild # Not implemented yet
)


$NDKPath = Get-Content $PSScriptRoot/ndkpath.txt

# Legacy arg check, might remove
for ($i = 0; $i -le $args.Length-1; $i++) {
echo "Arg $($i) is $($args[$i])"
if ($args[$i] -eq "--actions") { $actions = $true }
elseif ($args[$i] -eq "--release") { $release = $true }
}


if ($args.Count -eq 0 -or $actions -ne $true) {
$qpmshared = "./qpm.shared.json"
$qpmsharedJson = Get-Content $qpmshared -Raw | ConvertFrom-Json
$ModID = "ClockMod"
$VERSION = $qpmsharedJson.config.info.version.replace("-Dev", "")
if ($VERSION -eq $null) {
if ($null -eq $VERSION) {
$VERSION = "0.0.1"
}
if ($release -ne $true) {
Expand All @@ -20,12 +33,11 @@ if ($args.Count -eq 0 -or $actions -ne $true) {

if ($actions -eq $true) {
$ModID = $env:module_id
$BSHook = $env:bs_hook
$VERSION = $env:version
$codegen_ver = $env:codegen
} else {
& qpm package edit --version $VERSION
}

if ((Test-Path "./extern/includes/beatsaber-hook/shared/inline-hook/And64InlineHook.cpp", "./extern/includes/beatsaber-hook/shared/inline-hook/inlineHook.c", "./extern/includes/beatsaber-hook/shared/inline-hook/relocate.c") -contains $false) {
Write-Host "Critical: Missing inline-hook"
if (!(Test-Path "./extern/includes/beatsaber-hook/shared/inline-hook/And64InlineHook.cpp")) {
Expand Down
5 changes: 3 additions & 2 deletions rl-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
- Option to choose between the Clock being at the Top or the Bottom.

__**Changelog:**__
- Update to 1.35.0_8016709773
- Switch to BSML-Lite
- Update to 1.37.0_9064817954
- Fix positioning bug in Multiplayer
- Move clock slightly higher to avoid overlapping with BeatTogethers server selector

0 comments on commit e829260

Please sign in to comment.