|
10 | 10 | description: Existing release tag to publish or refresh |
11 | 11 | required: true |
12 | 12 | type: string |
| 13 | + publish_nexus: |
| 14 | + description: Upload the release package to Nexus Mods |
| 15 | + required: false |
| 16 | + default: true |
| 17 | + type: boolean |
| 18 | + publish_thunderstore: |
| 19 | + description: Upload the Thunderstore package to Thunderstore |
| 20 | + required: false |
| 21 | + default: true |
| 22 | + type: boolean |
13 | 23 |
|
14 | 24 | permissions: |
15 | 25 | contents: write |
16 | 26 |
|
| 27 | +env: |
| 28 | + NEXUSMODS_API_KEY: ${{ secrets.NEXUSMODS_API_KEY }} |
| 29 | + NEXUSMODS_FILE_GROUP_ID: ${{ secrets.NEXUSMODS_FILE_GROUP_ID || vars.NEXUSMODS_FILE_GROUP_ID }} |
| 30 | + RELEASE_DESCRIPTION: S1API is an open source collaboration project to help standardize Schedule One modding processes. The goal is to provide a standard place for common functionalities so you can focus on making content versus reverse engineering the game. |
| 31 | + THUNDERSTORE_COMMUNITY: schedule-i |
| 32 | + THUNDERSTORE_TOKEN: ${{ secrets.THUNDERSTORE_TOKEN }} |
| 33 | + THUNDERSTORE_NAMESPACE: ifBars |
| 34 | + THUNDERSTORE_PACKAGE_NAME: S1API_Forked |
| 35 | + THUNDERSTORE_CATEGORIES: libraries |
| 36 | + THUNDERSTORE_WEBSITE: https://github.com/ifBars/S1API |
| 37 | + |
17 | 38 | jobs: |
18 | 39 | publish-release: |
19 | 40 | runs-on: ubuntu-latest |
@@ -213,35 +234,77 @@ jobs: |
213 | 234 | dotnet build S1API/S1API.csproj --no-restore -c Il2CppMelon -v minimal /p:AutomateLocalDeployment=false |
214 | 235 | cp S1API/bin/Il2CppMelon/net6.0/S1API.dll artifacts/build/S1API.Il2Cpp.MelonLoader.dll |
215 | 236 |
|
216 | | - - name: Package release asset |
| 237 | + - name: Package release assets |
217 | 238 | id: package |
218 | 239 | shell: bash |
219 | 240 | run: | |
220 | 241 | set -euo pipefail |
221 | 242 |
|
222 | 243 | package_dir="artifacts/S1API-Forked-${{ steps.metadata.outputs.base_version }}" |
223 | 244 | zip_path="artifacts/S1API-Forked-${{ steps.metadata.outputs.base_version }}.zip" |
| 245 | + thunderstore_dir="artifacts/S1API-TS-${{ steps.metadata.outputs.base_version }}" |
| 246 | + thunderstore_zip_path="artifacts/S1API-TS-${{ steps.metadata.outputs.base_version }}.zip" |
224 | 247 |
|
225 | | - mkdir -p "${package_dir}/mods" "${package_dir}/plugins" |
226 | | - cp artifacts/build/S1API.Mono.MelonLoader.dll "${package_dir}/mods/S1API.Mono.MelonLoader.dll" |
227 | | - cp artifacts/build/S1API.Il2Cpp.MelonLoader.dll "${package_dir}/mods/S1API.Il2Cpp.MelonLoader.dll" |
228 | | - cp artifacts/build/S1APILoader.MelonLoader.dll "${package_dir}/plugins/S1APILoader.MelonLoader.dll" |
| 248 | + mkdir -p "${package_dir}/Mods" "${package_dir}/Plugins" |
| 249 | + cp artifacts/build/S1API.Mono.MelonLoader.dll "${package_dir}/Mods/S1API.Mono.MelonLoader.dll" |
| 250 | + cp artifacts/build/S1API.Il2Cpp.MelonLoader.dll "${package_dir}/Mods/S1API.Il2Cpp.MelonLoader.dll" |
| 251 | + cp artifacts/build/S1APILoader.MelonLoader.dll "${package_dir}/Plugins/S1APILoader.MelonLoader.dll" |
229 | 252 |
|
230 | 253 | ( |
231 | 254 | cd "${package_dir}" |
232 | | - zip -r "../$(basename "${zip_path}")" mods plugins |
| 255 | + zip -r "../$(basename "${zip_path}")" Mods Plugins |
233 | 256 | ) |
234 | 257 |
|
235 | 258 | unzip -l "${zip_path}" |
236 | 259 |
|
237 | 260 | for entry in \ |
238 | | - "mods/S1API.Mono.MelonLoader.dll" \ |
239 | | - "mods/S1API.Il2Cpp.MelonLoader.dll" \ |
240 | | - "plugins/S1APILoader.MelonLoader.dll"; do |
| 261 | + "Mods/S1API.Mono.MelonLoader.dll" \ |
| 262 | + "Mods/S1API.Il2Cpp.MelonLoader.dll" \ |
| 263 | + "Plugins/S1APILoader.MelonLoader.dll"; do |
241 | 264 | unzip -Z1 "${zip_path}" | grep -Fx "${entry}" >/dev/null |
242 | 265 | done |
243 | 266 |
|
| 267 | + mkdir -p "${thunderstore_dir}/Mods" "${thunderstore_dir}/Plugins" |
| 268 | + cp artifacts/build/S1API.Mono.MelonLoader.dll "${thunderstore_dir}/Mods/S1API.Mono.MelonLoader.dll" |
| 269 | + cp artifacts/build/S1API.Il2Cpp.MelonLoader.dll "${thunderstore_dir}/Mods/S1API.Il2Cpp.MelonLoader.dll" |
| 270 | + cp artifacts/build/S1APILoader.MelonLoader.dll "${thunderstore_dir}/Plugins/S1APILoader.MelonLoader.dll" |
| 271 | + cp Public/logo_compressed.png "${thunderstore_dir}/icon.png" |
| 272 | + cp Public/README.md "${thunderstore_dir}/README.md" |
| 273 | +
|
| 274 | + jq -n \ |
| 275 | + --arg name "${THUNDERSTORE_PACKAGE_NAME}" \ |
| 276 | + --arg version "${{ steps.metadata.outputs.base_version }}" \ |
| 277 | + --arg website "${THUNDERSTORE_WEBSITE}" \ |
| 278 | + --arg description "${RELEASE_DESCRIPTION}" \ |
| 279 | + '{ |
| 280 | + name: $name, |
| 281 | + version_number: $version, |
| 282 | + website_url: $website, |
| 283 | + description: $description, |
| 284 | + dependencies: ["LavaGang-MelonLoader-0.7.2"] |
| 285 | + }' > "${thunderstore_dir}/manifest.json" |
| 286 | +
|
| 287 | + ( |
| 288 | + cd "${thunderstore_dir}" |
| 289 | + zip -r "../$(basename "${thunderstore_zip_path}")" icon.png README.md manifest.json Mods Plugins |
| 290 | + ) |
| 291 | +
|
| 292 | + unzip -l "${thunderstore_zip_path}" |
| 293 | +
|
| 294 | + for entry in \ |
| 295 | + "icon.png" \ |
| 296 | + "README.md" \ |
| 297 | + "manifest.json" \ |
| 298 | + "Mods/S1API.Mono.MelonLoader.dll" \ |
| 299 | + "Mods/S1API.Il2Cpp.MelonLoader.dll" \ |
| 300 | + "Plugins/S1APILoader.MelonLoader.dll"; do |
| 301 | + unzip -Z1 "${thunderstore_zip_path}" | grep -Fx "${entry}" >/dev/null |
| 302 | + done |
| 303 | +
|
| 304 | + jq -e --arg version "${{ steps.metadata.outputs.base_version }}" '.version_number == $version' "${thunderstore_dir}/manifest.json" >/dev/null |
| 305 | +
|
244 | 306 | echo "zip_path=${zip_path}" >> "$GITHUB_OUTPUT" |
| 307 | + echo "thunderstore_zip_path=${thunderstore_zip_path}" >> "$GITHUB_OUTPUT" |
245 | 308 |
|
246 | 309 | - name: Publish or update GitHub release |
247 | 310 | uses: actions/github-script@v7 |
@@ -336,7 +399,50 @@ jobs: |
336 | 399 | const created = await github.rest.repos.createRelease(payload); |
337 | 400 | core.notice(`Published GitHub release ${created.data.html_url}`); |
338 | 401 |
|
339 | | - - name: Upload release asset |
| 402 | + - name: Upload GitHub release assets |
340 | 403 | env: |
341 | 404 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
342 | | - run: gh release upload "${{ steps.metadata.outputs.tag }}" "${{ steps.package.outputs.zip_path }}" --clobber |
| 405 | + run: | |
| 406 | + gh release upload "${{ steps.metadata.outputs.tag }}" "${{ steps.package.outputs.zip_path }}" --clobber |
| 407 | + gh release upload "${{ steps.metadata.outputs.tag }}" "${{ steps.package.outputs.thunderstore_zip_path }}" --clobber |
| 408 | +
|
| 409 | + - name: Upload Nexus Mods release |
| 410 | + if: ${{ (github.event_name != 'workflow_dispatch' || inputs.publish_nexus) && env.NEXUSMODS_API_KEY != '' && env.NEXUSMODS_FILE_GROUP_ID != '' }} |
| 411 | + uses: Nexus-Mods/upload-action@v1.0.0-beta.7 |
| 412 | + with: |
| 413 | + api_key: ${{ env.NEXUSMODS_API_KEY }} |
| 414 | + file_group_id: ${{ env.NEXUSMODS_FILE_GROUP_ID }} |
| 415 | + filename: ${{ steps.package.outputs.zip_path }} |
| 416 | + version: ${{ steps.metadata.outputs.base_version }} |
| 417 | + display_name: S1API Forked ${{ steps.metadata.outputs.base_version }} |
| 418 | + description: ${{ env.RELEASE_DESCRIPTION }} |
| 419 | + file_category: main |
| 420 | + archive_existing_file: true |
| 421 | + primary_mod_manager_download: true |
| 422 | + allow_mod_manager_download: true |
| 423 | + show_requirements_pop_up: false |
| 424 | + |
| 425 | + - name: Skip Nexus Mods upload |
| 426 | + if: ${{ (github.event_name != 'workflow_dispatch' || inputs.publish_nexus) && (env.NEXUSMODS_API_KEY == '' || env.NEXUSMODS_FILE_GROUP_ID == '') }} |
| 427 | + shell: bash |
| 428 | + run: echo "::notice::Skipping Nexus Mods upload because NEXUSMODS_API_KEY or NEXUSMODS_FILE_GROUP_ID is not configured." |
| 429 | + |
| 430 | + - name: Upload Thunderstore release |
| 431 | + if: ${{ (github.event_name != 'workflow_dispatch' || inputs.publish_thunderstore) && env.THUNDERSTORE_TOKEN != '' }} |
| 432 | + uses: GreenTF/upload-thunderstore-package@v4.3 |
| 433 | + with: |
| 434 | + token: ${{ env.THUNDERSTORE_TOKEN }} |
| 435 | + community: ${{ env.THUNDERSTORE_COMMUNITY }} |
| 436 | + namespace: ${{ env.THUNDERSTORE_NAMESPACE }} |
| 437 | + name: ${{ env.THUNDERSTORE_PACKAGE_NAME }} |
| 438 | + description: ${{ env.RELEASE_DESCRIPTION }} |
| 439 | + version: ${{ steps.metadata.outputs.base_version }} |
| 440 | + file: ${{ steps.package.outputs.thunderstore_zip_path }} |
| 441 | + repo: https://thunderstore.io |
| 442 | + website: ${{ env.THUNDERSTORE_WEBSITE }} |
| 443 | + categories: ${{ env.THUNDERSTORE_CATEGORIES }} |
| 444 | + |
| 445 | + - name: Skip Thunderstore upload |
| 446 | + if: ${{ (github.event_name != 'workflow_dispatch' || inputs.publish_thunderstore) && env.THUNDERSTORE_TOKEN == '' }} |
| 447 | + shell: bash |
| 448 | + run: echo "::notice::Skipping Thunderstore upload because THUNDERSTORE_TOKEN is not configured." |
0 commit comments