forked from sheakelso/ClockMod
-
Notifications
You must be signed in to change notification settings - Fork 4
132 lines (111 loc) · 4.42 KB
/
buildMod.yml
File metadata and controls
132 lines (111 loc) · 4.42 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: NDK build
on:
workflow_dispatch:
push:
branches: [ main, master, dev ]
paths-ignore:
- '**.yml'
- '!.github/workflows/buildMod.yml'
- '**.json'
- '!qpm.json'
- '**.ps1'
- '!build.ps1'
- '!buildQMOD.ps1'
- '**.md'
- '.gitignore'
- '**.ogg'
- '**.zip'
pull_request:
branches: [ main, dev ]
env:
module_id: ClockMod
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout
with:
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@v5
- name: Get QPM
uses: Fernthedev/qpm-action@v1
with:
resolve_ndk: true
#required
workflow_token: ${{secrets.GITHUB_TOKEN}}
restore: true # will run restore on download
cache: true #will cache dependencies
version: '${{ env.version }}'
#qpm_qmod: '${{ env.module_id }}_${{ env.qmodversion }}.qmod'
- name: QPM Collapse
run: |
qpm collapse
- name: Check dependency Folders
run: |
echo "Checking extern includes"
ls -lh ${GITHUB_WORKSPACE}/extern/includes
echo ""
echo "Checking libs"
ls -lh ${GITHUB_WORKSPACE}/extern/libs
echo ""
echo "Checking QPM/cache Folder"
ls -lh $HOME/.local/share/QPM-RS/cache
echo ""
- name: Get BSVersion & Update mod.template.json
shell: pwsh
run: |
$BSVersion = Get-Content ./extern/includes/bs-cordl/include/version.txt
echo "BSVersion=$($BSVersion)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$modTemplate = Get-Content ./mod.template.json -Raw | ConvertFrom-Json
$modTemplate.packageVersion = $BSVersion
$modTemplate | ConvertTo-Json | Out-File -FilePath ./mod.template.json -Encoding utf8
# - name: Temp Fix QPM extern.cmake issue
# shell: pwsh
# run: |
# $cmakeFilePath = "./extern.cmake"
# $externcmake = Get-Content $cmakeFilePath -Raw
# $partToRemove = 'add_library(${COMPILE_ID} SHARED ${EXTERN_DIR}/includes/bs-cordl/version.txt)'
# $externcmake -replace [regex]::Escape($partToRemove), '' | Set-Content $cmakeFilePath
# # $qpmjson = Get-Content ./qpm.json -Raw | ConvertFrom-Json
# # foreach ($dependency in $qpmjson.dependencies) { if ($dependency.id -eq "bs-cordl") { $dependency.additionalData.PSObject.Properties.Remove("extraFiles") } }
# # $qpmjson | ConvertTo-Json -Depth 5 | Out-File -FilePath ./qpm.json -Encoding utf8
# # qpm restore
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
pwsh -Command ./build.ps1 -actions
- name: Get Library Name
id: libname
run: |
cd ./build/
pattern="lib${module_id}*.so"
files=( $pattern )
echo "NAME=${files[0]}" >> $GITHUB_OUTPUT
- name: Package QMOD
run: |
cd ${GITHUB_WORKSPACE}
qpm qmod zip -i ./build/ -i ./extern/libs/ ${module_id}_${version}.qmod
- name: Upload non-debug artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.libname.outputs.NAME }}
path: ./build/${{ steps.libname.outputs.NAME }}
if-no-files-found: error
- name: Upload debug artifact
uses: actions/upload-artifact@v4
with:
name: debug_${{ steps.libname.outputs.NAME }}
path: ./build/debug/${{ steps.libname.outputs.NAME }}
if-no-files-found: error
- name: Upload QMOD
uses: actions/upload-artifact@v4
with:
name: ${{ env.module_id }}-(UNZIP-for-QMOD).qmod
path: ./${{ env.module_id }}_${{ env.version }}.qmod
if-no-files-found: warn