From 7bc7b80a5edd5f657a1e75f06d0095f9b5b95d61 Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 09:33:43 +0100 Subject: [PATCH 1/8] remove gradle publish command because the api is not implemented yet --- .github/workflows/publish.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2bff15d..7610328 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,8 +42,9 @@ jobs: echo "Setting version to $FULL_VERSION" sed -i "s/^project_version = .*/project_version = $FULL_VERSION/" gradle.properties echo "FULL_VERSION=$FULL_VERSION" >> $GITHUB_ENV - - name: Publish - run: ./gradlew publish --no-daemon --stacktrace + echo "VERSION=$VERSION" >> $GITHUB_ENV +# - name: Publish +# run: ./gradlew publish --no-daemon --stacktrace - name: Build Jar run: | ./gradlew clean @@ -68,8 +69,9 @@ jobs: ./modrinth-cli upload \ --project-id ${{secrets.PROJECT_ID}} \ --file ${{env.JAR_FILE}} \ - --version-name "${{env.FULL_VERSION}}" \ - --version-number "${{env.FULL_VERSION}}" \ + --version-name "${{env.VERSION}}" \ + --version-number "${{env.VERSION}}" \ --version-type ${{ env.version_type }} \ --game-versions "1.21.x" \ --loaders "paper,purpur" + --changelog "${{ github.event.release.body }}" From 6f0594cfc8bd4cb49c666bb79e7847c78219ba23 Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 09:38:34 +0100 Subject: [PATCH 2/8] fix jar file variable reference --- .github/workflows/publish.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7610328..58a6ce3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -58,8 +58,8 @@ jobs: curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/java-archive" \ - --data-binary @"${env.JAR_FILE}" \ - "${{ github.event.release.upload_url }}?name=$(basename "${env.JAR_FILE}")" + --data-binary @"$JAR_FILE" \ + "${{ github.event.release.upload_url }}?name=$(basename "$JAR_FILE")" - name: Install Modrinth CLI run: curl -sSL https://modrinth.github.io/cli/install.sh | bash - name: Upload to Modrinth @@ -67,11 +67,11 @@ jobs: MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} run: | ./modrinth-cli upload \ - --project-id ${{secrets.PROJECT_ID}} \ - --file ${{env.JAR_FILE}} \ - --version-name "${{env.VERSION}}" \ - --version-number "${{env.VERSION}}" \ - --version-type ${{ env.version_type }} \ + --project-id ${{ secrets.PROJECT_ID }} \ + --file "$JAR_FILE" \ + --version-name "$VERSION" \ + --version-number "$VERSION" \ + --version-type "$VERSION_TYPE" \ --game-versions "1.21.x" \ - --loaders "paper,purpur" + --loaders "paper,purpur" \ --changelog "${{ github.event.release.body }}" From 5d3e5ddb4d15a3a3ba204f42e2d21b78ca97163c Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 09:44:27 +0100 Subject: [PATCH 3/8] refactor to RubixDev/modrinth-upload@v1 --- .github/workflows/publish.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 58a6ce3..78fd9c6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -63,15 +63,16 @@ jobs: - name: Install Modrinth CLI run: curl -sSL https://modrinth.github.io/cli/install.sh | bash - name: Upload to Modrinth - env: - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - run: | - ./modrinth-cli upload \ - --project-id ${{ secrets.PROJECT_ID }} \ - --file "$JAR_FILE" \ - --version-name "$VERSION" \ - --version-number "$VERSION" \ - --version-type "$VERSION_TYPE" \ - --game-versions "1.21.x" \ - --loaders "paper,purpur" \ - --changelog "${{ github.event.release.body }}" + uses: RubixDev/modrinth-upload@v1 + with: + token: ${{ secrets.MODRINTH_TOKEN }} + file_path: ${{ env.JAR_FILE }} + name: ${{ env.VERSION }} + version: ${{ env.VERSION }} + changelog: ${{ github.event.release.body }} + relations: P7dR8mSH:required + game_versions: 1.19,1.19.1,1.19.2 + release_type: ${{ env.VERSION_TYPE }} + loaders: paper,purpur + featured: true + project_id: ${{ secrets.PROJECT_VERSION }} \ No newline at end of file From adb166414f56b6f7da62253dbffe8624a80cbfce Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 09:46:13 +0100 Subject: [PATCH 4/8] remove broken modrinth cli --- .github/workflows/publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 78fd9c6..7fbda50 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,8 +60,6 @@ jobs: -H "Content-Type: application/java-archive" \ --data-binary @"$JAR_FILE" \ "${{ github.event.release.upload_url }}?name=$(basename "$JAR_FILE")" - - name: Install Modrinth CLI - run: curl -sSL https://modrinth.github.io/cli/install.sh | bash - name: Upload to Modrinth uses: RubixDev/modrinth-upload@v1 with: From 4e17fa19f7309746392028df4dc85d0fd3212001 Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 09:47:58 +0100 Subject: [PATCH 5/8] fix gh release upload --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7fbda50..fa42bb4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,8 +57,8 @@ jobs: run: | curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/java-archive" \ - --data-binary @"$JAR_FILE" \ + -F "file=@$JAR_FILE" \ + -F "name=$(basename "$JAR_FILE")" \ "${{ github.event.release.upload_url }}?name=$(basename "$JAR_FILE")" - name: Upload to Modrinth uses: RubixDev/modrinth-upload@v1 From 49bc0fc62e8ee856d05e3a28db5a99d530d040a7 Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 09:52:05 +0100 Subject: [PATCH 6/8] fix modrinth upload --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fa42bb4..944bdc7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,9 +57,9 @@ jobs: run: | curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -F "file=@$JAR_FILE" \ - -F "name=$(basename "$JAR_FILE")" \ - "${{ github.event.release.upload_url }}?name=$(basename "$JAR_FILE")" + -F "file=@${env.JAR_FILE}" \ + -F "name=$(basename "${env.JAR_FILE}")" \ + "${{ github.event.release.upload_url }}?name=$(basename "${env.JAR_FILE}")" - name: Upload to Modrinth uses: RubixDev/modrinth-upload@v1 with: @@ -73,4 +73,4 @@ jobs: release_type: ${{ env.VERSION_TYPE }} loaders: paper,purpur featured: true - project_id: ${{ secrets.PROJECT_VERSION }} \ No newline at end of file + project_id: ${{ secrets.PROJECT_ID }} \ No newline at end of file From f706c831d620ede57bf086e95fb8c9cf08055f49 Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 10:14:12 +0100 Subject: [PATCH 7/8] fix modrinth publish --- .github/workflows/publish.yml | 50 +++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2bff15d..349607d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,8 +42,9 @@ jobs: echo "Setting version to $FULL_VERSION" sed -i "s/^project_version = .*/project_version = $FULL_VERSION/" gradle.properties echo "FULL_VERSION=$FULL_VERSION" >> $GITHUB_ENV - - name: Publish - run: ./gradlew publish --no-daemon --stacktrace + echo "VERSION=$VERSION" >> $GITHUB_ENV + # - name: Publish + # run: ./gradlew publish --no-daemon --stacktrace - name: Build Jar run: | ./gradlew clean @@ -54,22 +55,31 @@ jobs: echo "JAR_FILE=$JAR_FILE" >> $GITHUB_ENV - name: Upload Jar to Release run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/java-archive" \ - --data-binary @"${env.JAR_FILE}" \ - "${{ github.event.release.upload_url }}?name=$(basename "${env.JAR_FILE}")" - - name: Install Modrinth CLI - run: curl -sSL https://modrinth.github.io/cli/install.sh | bash + echo "File size: $(stat -c %s $JAR_FILE) bytes" + echo "${{ github.event.release.upload_url }}" + UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=$(basename "$JAR_FILE")" + + + # Upload the file to GitHub using the correct curl format + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$JAR_FILE" \ + "$UPLOAD_URL" - name: Upload to Modrinth - env: - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - run: | - ./modrinth-cli upload \ - --project-id ${{secrets.PROJECT_ID}} \ - --file ${{env.JAR_FILE}} \ - --version-name "${{env.FULL_VERSION}}" \ - --version-number "${{env.FULL_VERSION}}" \ - --version-type ${{ env.version_type }} \ - --game-versions "1.21.x" \ - --loaders "paper,purpur" + uses: RubixDev/modrinth-upload@v1 + with: + token: ${{ secrets.MODRINTH_TOKEN }} + file_path: ${{ env.JAR_FILE }} + name: ${{ env.VERSION }} + version: ${{ env.VERSION }} + changelog: ${{ github.event.release.body }} + relations: LuckPerms:optional + game_versions: 1.21.x + release_type: ${{ env.VERSION_TYPE }} + loaders: paper,purpur + featured: true + project_id: ${{ secrets.PROJECT_ID }} \ No newline at end of file From fe134c2dbcd6f5abe836aa7aafcae7fe63325ee3 Mon Sep 17 00:00:00 2001 From: Dario Pranjic Date: Tue, 31 Dec 2024 10:17:22 +0100 Subject: [PATCH 8/8] add debug --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 349607d..ddfe9f0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,6 +57,7 @@ jobs: run: | echo "File size: $(stat -c %s $JAR_FILE) bytes" echo "${{ github.event.release.upload_url }}" + echo $(basename "$JAR_FILE") UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=$(basename "$JAR_FILE")"