2024-01-08 06:17:58 +00:00
|
|
|
name: Build TurnBasedMC and create Release
|
2024-01-05 11:18:53 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-01-05 11:27:42 +00:00
|
|
|
tags:
|
|
|
|
- '*'
|
2024-01-05 11:18:53 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-01-22 09:26:21 +00:00
|
|
|
check-release-exists:
|
|
|
|
runs-on: any_archLinux
|
|
|
|
outputs:
|
|
|
|
status: ${{ steps.release_exists_check.outputs.http_code }}
|
|
|
|
steps:
|
|
|
|
- name: Check if release already exists
|
|
|
|
id: release_exists_check
|
|
|
|
run: |
|
|
|
|
curl -X GET "https://git.seodisparate.com/api/v1/repos/stephenseo/TurnBasedMinecraftMod/releases/tags/${GITHUB_REF_NAME}" \
|
|
|
|
-H 'accept: application/json' -o release_check_resp.json 2>/dev/null \
|
|
|
|
-w '%{http_code}\n' | sed 's/^\([0-9]\+\)/http_code=\1/' >> "$GITHUB_OUTPUT"
|
2024-01-08 09:34:00 +00:00
|
|
|
build-and-create-release:
|
2024-01-22 09:26:21 +00:00
|
|
|
needs: check-release-exists
|
|
|
|
if: ${{ needs.check-release-exists.outputs.status == '404' }}
|
2024-01-20 11:01:54 +00:00
|
|
|
runs-on: any_archLinux
|
2024-01-05 11:18:53 +00:00
|
|
|
steps:
|
|
|
|
- run: git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/TurnBasedMinecraftMod.git TurnBasedMinecraftMod
|
2024-01-05 11:27:42 +00:00
|
|
|
- run: cd TurnBasedMinecraftMod && git checkout ${GITHUB_REF_NAME}
|
2024-01-06 05:21:54 +00:00
|
|
|
- run: cd TurnBasedMinecraftMod && sed -i '/org.gradle.jvmargs/s/Xmx[0-9]\+m/Xmx1024m/' gradle.properties && echo 'neogradle.subsystems.decompiler.maxThreads=1' >> gradle.properties
|
2024-01-05 11:18:53 +00:00
|
|
|
- run: cd TurnBasedMinecraftMod && ./gradlew --console=plain build
|
2024-01-06 05:21:54 +00:00
|
|
|
- run: cd TurnBasedMinecraftMod/build/libs && find . -type f -regex '.*all.jar$' -exec sha256sum '{}' ';' -exec bash -c 'sha256sum {} >> sha256sums.txt' ';' && java --version >> javaVersion.txt && javac --version >> javaVersion.txt
|
|
|
|
- name: Create release and attach jar
|
|
|
|
run: |
|
|
|
|
curl --fail-with-body -X 'POST' \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/TurnBasedMinecraftMod/releases" \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d "{
|
2024-01-06 05:31:29 +00:00
|
|
|
\"name\": \"TurnBasedMinecraftMod version ${GITHUB_REF_NAME}\",
|
2024-01-06 05:21:54 +00:00
|
|
|
\"body\": \"See the [Changelog](https://git.seodisparate.com/stephenseo/TurnBasedMinecraftMod/src/branch/neoforge/Changelog.md)
|
2024-01-06 05:57:13 +00:00
|
|
|
|
2024-01-10 02:56:36 +00:00
|
|
|
$(java --version | sed -n '1p;2,$s/^/ /p')
|
2024-01-06 05:57:13 +00:00
|
|
|
$(javac --version)
|
|
|
|
$(find TurnBasedMinecraftMod/build/libs -regex '.*all.jar$' -exec sha256sum '{}' ';')\",
|
2024-01-06 05:21:54 +00:00
|
|
|
\"tag_name\": \"${GITHUB_REF_NAME}\"
|
|
|
|
}" > response.json \
|
|
|
|
&& curl --fail-with-body -X 'POST' \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/TurnBasedMinecraftMod/releases/$(jq .id < response.json)/assets" \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: multipart/form-data' \
|
|
|
|
-F "attachment=@$(find TurnBasedMinecraftMod/build/libs -regex '.*all.jar$');type=application/java-archive" > response2.json
|