diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 137da50..5e9d54f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -34,9 +34,31 @@ jobs: ls cordle-${VERSION}-linux-amd64.tar.gz* # For debugging - name: Create Release - uses: actions/release-action@main - with: - files: | - release/*.tar.gz - release/*.sha256 - api_key: ${{ secrets.RELEASE_TOKEN }} + env: + GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + VERSION=${GITHUB_REF#refs/tags/} + + # Create release + curl -X POST "https://repos.gmgauthier.com/api/v1/repos/${GITHUB_REPOSITORY}/releases" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"${VERSION}\", + \"name\": \"Cordle ${VERSION}\", + \"body\": \"Release ${VERSION}\" + }" > release_response.json + + RELEASE_ID=$(cat release_response.json | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) + + # Upload tarball + curl -X POST "https://repos.gmgauthier.com/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=cordle-${VERSION}-linux-amd64.tar.gz" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/gzip" \ + --data-binary @release/cordle-${VERSION}-linux-amd64.tar.gz + + # Upload checksum + curl -X POST "https://repos.gmgauthier.com/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=cordle-${VERSION}-linux-amd64.tar.gz.sha256" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: text/plain" \ + --data-binary @release/cordle-${VERSION}-linux-amd64.tar.gz.sha256