diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 9199a8a..98e4152 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -153,21 +153,38 @@ jobs: cat /tmp/release_notes.md - name: Create Gitea Release - uses: actions/gitea-release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag_name: ${{ steps.version.outputs.version }} - name: NUPST ${{ steps.version.outputs.version }} - body_path: /tmp/release_notes.md - draft: false - prerelease: false - files: | - dist/binaries/nupst-linux-x64 - dist/binaries/nupst-linux-arm64 - dist/binaries/nupst-macos-x64 - dist/binaries/nupst-macos-arm64 - dist/binaries/nupst-windows-x64.exe - dist/binaries/SHA256SUMS.txt + run: | + VERSION="${{ steps.version.outputs.version }}" + RELEASE_NOTES=$(cat /tmp/release_notes.md) + + # Create the release + echo "Creating release for $VERSION..." + RELEASE_ID=$(curl -X POST -s \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + "https://code.foss.global/api/v1/repos/serve.zone/nupst/releases" \ + -d "{ + \"tag_name\": \"$VERSION\", + \"name\": \"NUPST $VERSION\", + \"body\": $(jq -Rs . /tmp/release_notes.md), + \"draft\": false, + \"prerelease\": false + }" | jq -r '.id') + + echo "Release created with ID: $RELEASE_ID" + + # Upload binaries as release assets + for binary in dist/binaries/*; do + filename=$(basename "$binary") + echo "Uploading $filename..." + curl -X POST -s \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@$binary" \ + "https://code.foss.global/api/v1/repos/serve.zone/nupst/releases/$RELEASE_ID/assets?name=$filename" + done + + echo "All assets uploaded successfully" - name: Clean up old releases run: |