From 525cdb190fec021e1659d9ba8756752305bf0b28 Mon Sep 17 00:00:00 2001 From: Nikolay Govorov Date: Fri, 20 Mar 2026 23:53:40 +0000 Subject: Remove github-cli deps --- .forgejo/workflows/build.yml | 42 +++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 27bc329..c913439 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -163,25 +163,39 @@ jobs: git tag -f ${{ env.RELEASE_TAG }} git push origin --force tag ${{ env.RELEASE_TAG }} - - name: Delete old release assets + + - name: Update Forgejo release run: | - for asset in $(gh release view ${{ env.RELEASE_TAG }} --json assets --jq '.assets[].name' 2>/dev/null || true); do - gh release delete-asset ${{ env.RELEASE_TAG }} "$asset" --yes + call() { + curl -sS -X "$1" \ + -H "Content-Type: $2" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases$3" \ + "${@:4}"; + } + + # Delete existing release + RELEASE_ID=$(call GET "" "/tags/${{ env.RELEASE_TAG }}" | jq -r '.id // empty') + if [ -n "$RELEASE_ID" ]; then + call DELETE "" "/$RELEASE_ID" + fi + + # Create release and upload assets + RELEASE_ID=$(jq -n \ + --arg name "${{ env.RELEASE_TAG }}" \ + --arg body "${{ env.description }}" \ + '{name: $name, tag_name: $name, body: $body}' \ + | call POST application/json "/" -d @- | jq -r '.id') + + for file in dist/*; do + call POST application/octet-stream "/$RELEASE_ID/assets?name=$(basename "$file")" \ + --data-binary @"$file" done env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Forgejo Release - uses: https://github.com/softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 - with: - name: ${{ env.RELEASE_TAG }} - tag_name: ${{ env.RELEASE_TAG }} - files: dist/* - body: | + description: | Last successful build from `main` branch. **Release checks**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Update APT/RPM repos on s3 - name: Create APT repository @@ -189,6 +203,7 @@ jobs: aptly repo create -distribution=nightly -component=main recluse aptly repo add recluse dist/*.deb aptly publish repo -architectures=amd64,arm64 -gpg-key="${{vars.GPG_KEY_ID}}" recluse + - name: Create RPM repository run: | mkdir -p rpm-repo @@ -205,6 +220,7 @@ jobs: createrepo_c rpm-repo/ gpg --default-key="${{vars.GPG_KEY_ID}}" --detach-sign --armor rpm-repo/repodata/repomd.xml + - name: Upload RPM to S3 run: | mkdir -p ~/.config/rclone -- Gilti