Use Forgejo API directly for releases
All checks were successful
Build and Release / build (push) Successful in 1m27s

The forgejo-release action has issues on NixOS runner.

💘 Generated with Crush

Assisted-by: Claude Opus 4.5 via Crush <crush@charm.land>
This commit is contained in:
Chris Kruining 2026-02-03 15:55:27 +01:00
parent 47a9442878
commit 86aa0f856c
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2

View file

@ -12,7 +12,7 @@ jobs:
steps:
- name: Install dependencies
run: |
nix-env -iA nixpkgs.nodejs nixpkgs.openssh nixpkgs.curl nixpkgs.dotnetCorePackages.sdk_10_0-bin
nix-env -iA nixpkgs.nodejs nixpkgs.openssh nixpkgs.curl nixpkgs.jq nixpkgs.dotnetCorePackages.sdk_10_0-bin
dotnet --version
- name: Checkout
@ -54,9 +54,26 @@ jobs:
chmod +x release/scry-embedded-linux-x64 release/scry-embedded-osx-x64
- name: Create Release
uses: https://code.forgejo.org/actions/forgejo-release@v2
with:
direction: upload
release-dir: release
release-notes: "Automated release from CI"
tag: ${{ github.run_number }}
env:
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="build-${{ github.run_number }}"
REPO="${{ github.repository }}"
API_URL="https://git.amarth.cloud/api/v1"
# Create release
RELEASE_ID=$(curl -fsSL -X POST \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG\", \"name\": \"$TAG\", \"body\": \"Automated release from CI\"}" \
"$API_URL/repos/$REPO/releases" | jq -r '.id')
# Upload assets
for file in release/*; do
filename=$(basename "$file")
curl -fsSL -X POST \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$file" \
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=$filename"
done