name: Release Standalone Builder on: release: types: [published] workflow_dispatch: jobs: build: runs-on: local steps: - name: Checkout repository uses: actions/checkout@v4 - name: Build standalone executable run: | chmod +x tools/build-standalone.sh ./tools/build-standalone.sh - name: Setup Go uses: actions/setup-go@v5 with: go-version: '1.21' - name: Upload Release Asset uses: https://gitea.com/actions/release-action@main with: files: |- kewt api_key: '${{secrets.GITEA_TOKEN}}' - name: Push to GitHub Release run: | TAG="${GITHUB_REF#refs/tags/}" # Fetch release body from Gitea RELEASE_BODY=$(curl -sL \ "https://git.krzak.org/api/v1/repos/N0VA/kewt/releases/tags/${TAG}" \ | jq -r '.body // ""') # Build JSON payload PAYLOAD=$(jq -n \ --arg tag "$TAG" \ --arg name "Release $TAG" \ --arg body "$RELEASE_BODY" \ '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}') # Create the release on GitHub curl -sL -X POST \ -H "Authorization: token ${{ secrets.GH_RELEASE_TOKEN }}" \ -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/n0va-bot/kewt/releases" \ -d "$PAYLOAD" || true # Get the release ID RELEASE_ID=$(curl -sL \ -H "Authorization: token ${{ secrets.GH_RELEASE_TOKEN }}" \ -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/n0va-bot/kewt/releases/tags/${TAG}" | jq -r '.id') # Upload the asset curl -sL -X POST \ -H "Authorization: token ${{ secrets.GH_RELEASE_TOKEN }}" \ -H "Content-Type: application/octet-stream" \ "https://uploads.github.com/repos/n0va-bot/kewt/releases/${RELEASE_ID}/assets?name=kewt" \ --data-binary @kewt publish-aur: runs-on: local needs: build steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Arch Linux environment run: | sudo apt-get update sudo apt-get install -y openssh-client curl jq - name: Render PKGBUILD and SRCINFO run: | VERSION=${GITHUB_REF#refs/tags/v} VERSION=${VERSION#refs/tags/} curl -sL -o kewt https://git.krzak.org/N0VA/kewt/releases/download/v${VERSION}/kewt CHECKSUM=$(sha256sum kewt | awk '{print $1}') mkdir -p aur-work sed -e "s/VERSION_PLACEHOLDER/${VERSION}/g" \ -e "s/SHA256SUM_PLACEHOLDER/${CHECKSUM}/g" \ packaging/AUR/PKGBUILD.template > aur-work/PKGBUILD sed -e "s/VERSION_PLACEHOLDER/${VERSION}/g" \ -e "s/SHA256SUM_PLACEHOLDER/${CHECKSUM}/g" \ packaging/AUR/.SRCINFO.template > aur-work/.SRCINFO - name: Setup AUR SSH run: | mkdir -p ~/.ssh printf '%s\n' "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -H aur.archlinux.org >> ~/.ssh/known_hosts - name: Publish to AUR run: | rm -rf aur-repo git clone "ssh://aur@aur.archlinux.org/kewt-bin.git" aur-repo cp aur-work/PKGBUILD aur-repo/PKGBUILD cp aur-work/.SRCINFO aur-repo/.SRCINFO cd aur-repo git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git add PKGBUILD .SRCINFO git commit -m "Update kewt-bin to ${GITHUB_REF_NAME}" || exit 0 GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes" git push origin HEAD:master publish-homebrew: runs-on: local needs: build steps: - name: Checkout repository uses: actions/checkout@v4 - name: Render Formula and push to GitHub run: | TAG="${GITHUB_REF#refs/tags/}" VERSION="${TAG#v}" curl -sL -o kewt-binary \ "https://git.krzak.org/N0VA/kewt/releases/download/${TAG}/kewt" CHECKSUM=$(sha256sum kewt-binary | awk '{print $1}') rm -f kewt-binary git clone https://x-access-token:${{ secrets.GH_RELEASE_TOKEN }}@github.com/n0va-bot/homebrew-tap.git brew-work || true mkdir -p brew-work/Formula sed -e "s/VERSION_PLACEHOLDER/${VERSION}/g" \ -e "s/SHA256SUM_PLACEHOLDER/${CHECKSUM}/g" \ packaging/homebrew/kewt.rb.template > brew-work/Formula/kewt.rb cd brew-work [ -d .git ] || { git init && git checkout --orphan main && git remote add origin https://x-access-token:${{ secrets.GH_RELEASE_TOKEN }}@github.com/n0va-bot/homebrew-tap.git; } git add Formula/kewt.rb git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git commit -m "Update kewt to ${TAG}" || echo "No changes to commit" git push -u origin main