TurnBasedMinecraftMod/.forgejo/workflows/build-jar.yaml

37 lines
2 KiB
YAML
Raw Normal View History

name: Build TurnBasedMC and store Artifact
on:
push:
2024-01-05 07:19:43 +00:00
tags:
2024-01-05 08:06:04 +00:00
- '*'
jobs:
build-and-store-artifact:
runs-on: archLinux
steps:
2024-01-05 07:27:27 +00:00
- run: git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/TurnBasedMinecraftMod.git TurnBasedMinecraftMod
2024-01-05 07:19:43 +00:00
- run: cd TurnBasedMinecraftMod && git checkout ${GITHUB_REF_NAME}
2024-01-05 07:27:27 +00:00
- run: cd TurnBasedMinecraftMod && sed -i '/org.gradle.jvmargs/s/Xmx[0-9]\+m/Xmx700m/' gradle.properties
- run: cd TurnBasedMinecraftMod && ./gradlew --console=plain build
2024-01-05 07:29:02 +00:00
- run: cd TurnBasedMinecraftMod/build/libs && find . -type f -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 "{
\"name\": \"TurnBasedMinecraftMod version ${GITHUB_REF_NAME}\",
2024-01-06 05:33:54 +00:00
\"body\": \"See the [Changelog](https://git.seodisparate.com/stephenseo/TurnBasedMinecraftMod/src/branch/master/Changelog.md)
$(javac --version)
$(find TurnBasedMinecraftMod/build/libs -regex '.*[0-9].jar$' -exec sha256sum '{}' ';')\",
\"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 '.*[0-9].jar$');type=application/java-archive" > response2.json