only upload the correct jar file
This commit is contained in:
@@ -77,14 +77,20 @@ jobs:
|
|||||||
- name: Install jq
|
- name: Install jq
|
||||||
run: apt-get update && apt-get install -y 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: |
|
run: |
|
||||||
NAME=$(grep "^archives_base_name" gradle.properties | cut -d'=' -f2)
|
NAME=$(grep "^archives_base_name" gradle.properties | cut -d'=' -f2)
|
||||||
VERSION=$(grep "^mod_version" 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 "NAME=$NAME" >> $GITEA_ENV
|
||||||
echo "VERSION=$VERSION" >> $GITEA_ENV
|
echo "VERSION=$VERSION" >> $GITEA_ENV
|
||||||
|
echo "JAR=$JAR" >> $GITEA_ENV
|
||||||
- name: Determine tag
|
- name: Determine tag
|
||||||
run: |
|
run: |
|
||||||
BASE="${NAME}-${VERSION}"
|
BASE="${NAME}-${VERSION}"
|
||||||
@@ -123,12 +129,15 @@ jobs:
|
|||||||
|
|
||||||
echo "RELEASE_ID=$RELEASE_ID" >> $GITEA_ENV
|
echo "RELEASE_ID=$RELEASE_ID" >> $GITEA_ENV
|
||||||
|
|
||||||
- name: Upload jar to release
|
- name: Upload the mod JAR
|
||||||
run: |
|
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 \
|
curl -X POST \
|
||||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||||
-H "Content-Type: application/java-archive" \
|
-H "Content-Type: application/java-archive" \
|
||||||
--data-binary @"$FILE" \
|
--data-binary @"$JAR" \
|
||||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=$(basename $FILE)"
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=$(basename $JAR)"
|
||||||
Reference in New Issue
Block a user