diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index ebecb4b..31e84fc 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -30,14 +30,28 @@ jobs: run: | cp dist/TinyWeb TinyWeb-linux-x64 chmod +x TinyWeb-linux-x64 + ls -la TinyWeb-linux-x64 - name: Create Release if: startsWith(github.ref, 'refs/tags/v') - uses: https://code.forgejo.org/actions/forgejo-release@v2 - with: - direction: upload - release-dir: . - override: true - env: - FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} + run: | + TAG="${{ github.ref_name }}" + REPO="${{ github.repository }}" + TOKEN="${{ secrets.FORGEJO_TOKEN }}" + # Try to create release (ignore error if exists) + curl -X POST "https://git.derickphan.com/api/v1/repos/$REPO/releases" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" || true + + - name: Upload to Release + if: startsWith(github.ref, 'refs/tags/v') + run: | + FILE=TinyWeb-linux-x64 + TAG="${{ github.ref_name }}" + REPO="${{ github.repository }}" + TOKEN="${{ secrets.FORGEJO_TOKEN }}" + curl -X POST "https://git.derickphan.com/api/v1/repos/$REPO/releases/$TAG/assets" \ + -H "Authorization: token $TOKEN" \ + -F "attachment=@$FILE"