name: Build Arch package on: push: tags: ['v*'] workflow_dispatch: jobs: build: runs-on: ubuntu-latest container: image: archlinux:base-devel steps: - name: Prepare build user run: | pacman -Syu --noconfirm git nodejs-lts-jod npm sudo jq useradd -m builder echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder chmod 440 /etc/sudoers.d/builder - uses: actions/checkout@v4 - name: Build package run: | chown -R builder:builder . sudo -u builder makepkg -sf --noconfirm - name: Upload artifact uses: actions/upload-artifact@v3 with: name: grok-bot-bin path: '*.pkg.tar.zst' if-no-files-found: error - name: Attach package to Gitea release if: startsWith(github.ref, 'refs/tags/') env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | set -euo pipefail tag="${GITHUB_REF_NAME}" ver="${tag#v}" pkg=$(ls -1 *.pkg.tar.zst | head -1) api="${GITHUB_API_URL:-https://git.s1d3sw1ped.com/api/v1}/repos/${GITHUB_REPOSITORY}/releases" # create release if missing curl -fsS -X POST -H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${tag}\",\"name\":\"${tag}\",\"body\":\"grok-bot-bin ${ver} (official .deb repackaged)\"}" \ "$api" || true rid=$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" "$api/tags/${tag}" | jq -r .id) curl -fsS -X POST -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary @"$pkg" \ "${GITHUB_SERVER_URL:-https://git.s1d3sw1ped.com}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${rid}/assets?name=$(basename "$pkg")"