From 034fac759c253b5d1b25ade725a6eee4f3c01e4c Mon Sep 17 00:00:00 2001 From: TGGamesYT Date: Tue, 31 Mar 2026 17:05:57 +0200 Subject: [PATCH] only upload the correct jar file --- .gitea/workflows/build.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 1d71718..b3651cc 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -77,14 +77,20 @@ jobs: - name: Install jq run: apt-get update && apt-get install -y jq - - name: Read mod info again + - name: Read mod info from gradle.properties + id: mod_info run: | NAME=$(grep "^archives_base_name" gradle.properties | cut -d'=' -f2) VERSION=$(grep "^mod_version" gradle.properties | cut -d'=' -f2) + if [ -z "$NAME" ] || [ -z "$VERSION" ]; then + echo "Failed to read mod info" + exit 1 + fi + JAR="build/libs/${NAME}-${VERSION}.jar" echo "NAME=$NAME" >> $GITEA_ENV echo "VERSION=$VERSION" >> $GITEA_ENV - + echo "JAR=$JAR" >> $GITEA_ENV - name: Determine tag run: | BASE="${NAME}-${VERSION}" @@ -123,12 +129,15 @@ jobs: echo "RELEASE_ID=$RELEASE_ID" >> $GITEA_ENV - - name: Upload jar to release + - name: Upload the mod JAR run: | - FILE=$(ls ./release-artifacts/*.jar | head -n 1) + if [ ! -f "$JAR" ]; then + echo "Error: JAR not found: $JAR" + exit 1 + fi curl -X POST \ -H "Authorization: token ${{ secrets.GITEATOKEN }}" \ -H "Content-Type: application/java-archive" \ - --data-binary @"$FILE" \ - "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=$(basename $FILE)" \ No newline at end of file + --data-binary @"$JAR" \ + "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=$(basename $JAR)" \ No newline at end of file