From 643d1418ec5dd0ab62ec3683587c0d5e0355bd44 Mon Sep 17 00:00:00 2001 From: nekohepott Date: Wed, 17 Jun 2026 04:16:35 +0300 Subject: [PATCH] ... --- .forgejo/workflows/release.yaml | 43 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml index 6d24a41..dcd1a26 100644 --- a/.forgejo/workflows/release.yaml +++ b/.forgejo/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y chafa libglib2.0-dev + sudo apt-get install -y chafa libglib2.0-dev jq - name: Build binary run: make build @@ -32,25 +32,22 @@ jobs: run: | tar -czvf gogofetch-${{ github.ref_name }}-linux-amd64.tar.gz gogofetch Makefile logos/ - - name: Create Release and Upload Asset - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const assetName = `gogofetch-${context.ref.replace('refs/tags/', '')}-linux-amd64.tar.gz`; - - const release = await github.rest.repos.createRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: context.ref.replace('refs/tags/', ''), - name: `Release ${context.ref.replace('refs/tags/', '')}`, - body: "Automated binary release for Arch Linux AUR" - }); - - await github.rest.repos.uploadReleaseAsset({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: release.data.id, - name: assetName, - data: fs.readFileSync(`./${assetName}`) - }); \ No newline at end of file + - name: Create Release and Upload Asset via API + run: | + TAG="${{ github.ref_name }}" + REPO="${{ github.repository }}" + TOKEN="${{ secrets.GITHUB_TOKEN }}" + ASSET="gogofetch-${TAG}-linux-amd64.tar.gz" + + RELEASE_ID=$(curl -X POST "${{ github.server_url }}/api/v1/repos/${REPO}/releases" \ + -H "Authorization: token ${TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"master\",\"name\":\"Release ${TAG}\",\"body\":\"Automated binary release for Arch Linux AUR\",\"draft\":false,\"prerelease\":false}" \ + | jq '.id') + + echo "Created release with ID: ${RELEASE_ID}" + + curl -X POST "${{ github.server_url }}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \ + -H "Authorization: token ${TOKEN}" \ + -H "Accept: application/json" \ + -F "attachment=@./${ASSET}" \ No newline at end of file