-
Notifications
You must be signed in to change notification settings - Fork 1
188 lines (161 loc) · 5.7 KB
/
publish.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Publish QMod
env:
module_id: HotSwappableMods
qmodName: Hot-Swappable_Mods
cache-name: HotSwappableMods_cache
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout
with:
submodules: true
lfs: true
- uses: seanmiddleditch/gha-setup-ninja@v3
- name: Create ndkpath.txt
run: |
echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt
cat ${GITHUB_WORKSPACE}/ndkpath.txt
- name: Get QPM
if: steps.cache-qpm.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: cargo-build.yml
name: linux-qpm-rust
path: QPM
repo: RedBrumbler/QuestPackageManager-Rust
- name: QPM Collapse
run: |
chmod +x ./QPM/qpm-rust
./QPM/qpm-rust collapse
# added the cache on the off chance the qpm.json stays the same across versions
- name: QPM Dependencies Cache
id: cache-qpm-deps
uses: actions/cache@v2
env:
cache-name: cache-qpm-deps
with:
path: /home/runner/.local/share/QPM-Rust/cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('qpm.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: QPM Restore
run: |
chmod +x ./QPM/qpm-rust
./QPM/qpm-rust restore
- name: QPM Legacy fix
run: |
chmod +x ./QPM/qpm-rust
./QPM/qpm-rust cache legacy-fix
- name: List Post Restore
run: |
echo includes:
ls -la ${GITHUB_WORKSPACE}/extern/includes
echo libs:
ls -la ${GITHUB_WORKSPACE}/extern/libs
echo cache:
ls -la $HOME/.local/share/QPM-Rust/cache
- name: Get Tag Version
id: get_tag_version
run: |
echo ${GITHUB_REF#refs/tags/}
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: QPM Edit Version
run: |
./QPM/qpm-rust package edit --version "${{ steps.get_tag_version.outputs.VERSION }}"
- name: Create mod.json
run: |
chmod +x ./QPM/qpm-rust
./QPM/qpm-rust qmod build --include_libs "libbeatsaber-hook_2_3_2.so" --include_libs "libHotSwappableMods.so"
- name: Build Qmod
run: |
pwsh -Command ./buildQMOD.ps1 ${{env.qmodName}} -clean
# Commit the change to the package, .vscode/c_cpp_properties.json, and Android.mk
- name: Configure commit
run: |
git config user.name "Github Actions"
git config user.email "<>"
- name: Commit Edit Version
continue-on-error: true
run: |
git add qpm.json
git commit --allow-empty -m "Update Version and post restore"
# Then, we want to use the commit we have just made, and force push our tag to that commit
- name: Get Commit ID
id: get_commit_id
run: |
echo `git rev-parse HEAD`
echo ::set-output name=ID::`git rev-parse HEAD`
- name: Force create tag
run: |
git tag --force ${{ steps.get_tag_version.outputs.TAG }} ${{ steps.get_commid_id.outputs.ID }}
# Then, push, upload our artifacts, modify the config file to have soLink and debugSoLink
- name: Create and push version specific branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git branch version-${{ steps.get_tag_version.outputs.TAG }}
git push -u origin version-${{ steps.get_tag_version.outputs.TAG }} --force --tags
# Get release that was created for this tag
- name: Get Release
uses: octokit/[email protected]
id: get_release
with:
route: GET /repos/:repository/releases/tags/${{ steps.get_tag_version.outputs.TAG }}
repository: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Release Upload URL
id: get_upload_url
run: |
url=$(echo "$response" | jq -r '.upload_url')
echo $url
echo "::set-output name=upload_url::$url"
env:
response: ${{ steps.get_release.outputs.data }}
- name: Get Library Name
id: libname
run: |
cd ./build/
pattern="lib${module_id}*.so"
files=( $pattern )
echo ::set-output name=NAME::"${files[0]}"
- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
asset_path: ./build/${{ steps.libname.outputs.NAME }}
asset_name: ${{ steps.libname.outputs.NAME }}
asset_content_type: application/octet-stream
- name: Upload Debug Asset
id: upload_debug_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
asset_path: ./build/debug_${{ steps.libname.outputs.NAME }}
asset_name: debug_${{ steps.libname.outputs.NAME }}
asset_content_type: application/octet-stream
- name: Upload Qmod Asset
id: upload_qmod_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
asset_path: ./${{env.qmodName}}.qmod
asset_name: ${{env.qmodName}}-${{ steps.get_tag_version.outputs.TAG }}.qmod
asset_content_type: application/octet-stream