From ef24c21df4484bbd5d192518eedd85cd329bf2a2 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jun 2025 13:25:43 +0100 Subject: [PATCH] Update .forgejo/workflows/release.yml --- .forgejo/workflows/release.yml | 45 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index e49ccd7..b0fb402 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -107,34 +107,33 @@ jobs: path: target/resilient*.jar # auto-create a release - - name: Create release and upload JAR to Forgejo + - name: Create release and upload JAR run: | - # Install Forgejo CLI - echo "Downloading forgejo-linux-amd64 ..." - wget https://codeberg.org/Cyborus/forgejo-cli/releases/download/v0.2.0/forgejo-cli-linux-amd64 -O /usr/local/bin/forgejo - echo "Downloaded forgejo-linux-amd64" - echo "chmod +x /usr/local/bin/forgejo" - chmod +x /usr/local/bin/forgejo + VERSION=${{ steps.version.outputs.release_version }} + API="https://git.oguerreiro.com/api/v1" + REPO="root/resilient" - # Verify binary - echo "Verify binary" - file /usr/local/bin/forgejo # Should say: ELF 64-bit ... - - # Configure Forgejo CLI with token - forgejo config --host https://git.oguerreiro.com --token "${{ secrets.FORGEJO_TOKEN }}" + # Create release + RESPONSE=$(curl -s -X POST "$API/repos/$REPO/releases" \ + -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"v$VERSION\", + \"target_commitish\": \"master\", + \"name\": \"Release v$VERSION\", + \"body\": \"Automated release by CI\" + }") - # Extract version - VERSION="${{ steps.version.outputs.release_version }}" + RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id') - # Create the release - forgejo release create "v$VERSION" \ - --title "Release $VERSION" \ - --notes "Automated release created by CI" \ - --repo root/resilient + echo "Created release ID: $RELEASE_ID" + + # Upload artifact + curl -s -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=resilient.jar" \ + -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \ + -H "Content-Type: application/java-archive" \ + --data-binary @"target/resilient*.jar" - # Upload the JAR artifact - forgejo release upload "v$VERSION" target/resilient*.jar \ - --repo root/resilient # ################################################################## # ## THIS IS A RELEASE - Change master version to next SNAPSHOT ##