diff options
| author | KunoiSayami <[email protected]> | 2026-06-11 21:25:40 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2026-06-11 21:26:00 +0800 |
| commit | 3ec428be1eca4a6d3831a240f2cc5e4e8bc14436 (patch) | |
| tree | b89bc98e5d55d83900c429e75201ba9ca758e53e | |
| parent | d93c0a65587e384a97fe78a733ff94cc44ab4659 (diff) | |
feat(ci): Add auto fetch version script
* feat(pkg): Add sing-box-beta-bin
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: KunoiSayami <[email protected]>
| -rw-r--r-- | .github/workflows/update-pkgbuilds.yml | 135 | ||||
| -rw-r--r-- | repo/sing-box-beta-bin/PKGBUILD | 27 |
2 files changed, 162 insertions, 0 deletions
diff --git a/.github/workflows/update-pkgbuilds.yml b/.github/workflows/update-pkgbuilds.yml new file mode 100644 index 0000000..a36e29d --- /dev/null +++ b/.github/workflows/update-pkgbuilds.yml @@ -0,0 +1,135 @@ +name: Update PKGBUILDs + +on: + schedule: + - cron: '0 4 * * *' + workflow_dispatch: + +jobs: + update-sing-box-beta-bin: + name: Update sing-box-beta-bin + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Get latest pre-release version + id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION=$(gh api repos/SagerNet/sing-box/releases \ + --jq '[.[] | select(.prerelease)] | first | .tag_name | ltrimstr("v")') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Check current version + id: check + run: | + CURRENT=$(grep '^_pkgver=' repo/sing-box-beta-bin/PKGBUILD | cut -d'"' -f2) + echo "current=$CURRENT" >> "$GITHUB_OUTPUT" + if [ "$CURRENT" = "${{ steps.version.outputs.version }}" ]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + + - name: Download assets and compute sha256sums + if: steps.check.outputs.skip == 'false' + id: sums + env: + VERSION: ${{ steps.version.outputs.version }} + GIT_URL: https://github.com/SagerNet/sing-box + run: | + for ARCH in x86_64 aarch64 armv7h; do + # upstream uses armv7hl in filenames for armv7h + FILE_ARCH="$ARCH" + [ "$ARCH" = "armv7h" ] && FILE_ARCH="armv7hl" + FILE="sing-box_${VERSION}_linux_${FILE_ARCH}.pkg.tar.zst" + URL="$GIT_URL/releases/download/v${VERSION}/$FILE" + wget -q "$URL" -O "$FILE" + SUM=$(sha256sum "$FILE" | awk '{print $1}') + echo "sum_${ARCH}=$SUM" >> "$GITHUB_OUTPUT" + rm "$FILE" + done + + - name: Update PKGBUILD + if: steps.check.outputs.skip == 'false' + env: + VERSION: ${{ steps.version.outputs.version }} + SUM_X86_64: ${{ steps.sums.outputs.sum_x86_64 }} + SUM_ARMV7H: ${{ steps.sums.outputs.sum_armv7h }} + SUM_AARCH64: ${{ steps.sums.outputs.sum_aarch64 }} + run: | + sed -i "s/^_pkgver=.*/_pkgver=\"${VERSION}\"/" repo/sing-box-beta-bin/PKGBUILD + sed -i "s/^pkgrel=.*/pkgrel=\"1\"/" repo/sing-box-beta-bin/PKGBUILD + sed -i "s/^sha256sums_x86_64=.*/sha256sums_x86_64=(\"${SUM_X86_64}\")/" repo/sing-box-beta-bin/PKGBUILD + sed -i "s/^sha256sums_armv7h=.*/sha256sums_armv7h=(\"${SUM_ARMV7H}\")/" repo/sing-box-beta-bin/PKGBUILD + sed -i "s/^sha256sums_aarch64=.*/sha256sums_aarch64=(\"${SUM_AARCH64}\")/" repo/sing-box-beta-bin/PKGBUILD + + - name: Commit and push + if: steps.check.outputs.skip == 'false' + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add repo/sing-box-beta-bin/PKGBUILD + git commit -m "feat(pkg): Update sing-box-beta-bin to ${VERSION}" + git push + + update-telegram-bot-api: + name: Update telegram-bot-api + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Get latest release + id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION=$(gh api repos/tdlib/telegram-bot-api/releases/latest --jq '.tag_name | ltrimstr("v")') + COMMIT=$(gh api repos/tdlib/telegram-bot-api/git/refs/tags/"$(gh api repos/tdlib/telegram-bot-api/releases/latest --jq '.tag_name')" \ + --jq 'if .object.type == "tag" then .object.sha else .object.sha end') + # Resolve annotated tag to commit + TYPE=$(gh api repos/tdlib/telegram-bot-api/git/refs/tags/"$(gh api repos/tdlib/telegram-bot-api/releases/latest --jq '.tag_name')" --jq '.object.type') + if [ "$TYPE" = "tag" ]; then + COMMIT=$(gh api repos/tdlib/telegram-bot-api/git/tags/"$COMMIT" --jq '.object.sha') + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "commit=$COMMIT" >> "$GITHUB_OUTPUT" + + - name: Check current version + id: check + run: | + CURRENT=$(grep '^pkgver=' repo/telegram-bot-api/PKGBUILD | cut -d'=' -f2) + echo "current=$CURRENT" >> "$GITHUB_OUTPUT" + if [ "$CURRENT" = "${{ steps.version.outputs.version }}" ]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + + - name: Update PKGBUILD + if: steps.check.outputs.skip == 'false' + env: + VERSION: ${{ steps.version.outputs.version }} + COMMIT: ${{ steps.version.outputs.commit }} + run: | + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" repo/telegram-bot-api/PKGBUILD + sed -i "s/^pkgrel=.*/pkgrel=1/" repo/telegram-bot-api/PKGBUILD + sed -i "s/#commit=[0-9a-f]*/#commit=${COMMIT}/" repo/telegram-bot-api/PKGBUILD + + - name: Commit and push + if: steps.check.outputs.skip == 'false' + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add repo/telegram-bot-api/PKGBUILD + git commit -m "feat(pkg): Update telegram-bot-api to ${VERSION}" + git push diff --git a/repo/sing-box-beta-bin/PKGBUILD b/repo/sing-box-beta-bin/PKGBUILD new file mode 100644 index 0000000..25f49af --- /dev/null +++ b/repo/sing-box-beta-bin/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Mike Lei <[email protected]> +# Contributor: adityaphra <[email protected]> +# source: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=sing-box-beta-bin + +pkgname="sing-box-beta-bin" +_pkgver="1.14.0-alpha.29" +pkgver="${_pkgver/-/\~}" +pkgrel="1" +pkgdesc="The universal proxy platform (beta binary version)." +provides=("sing-box") +conflicts=("sing-box" "sing-box-bin" "sing-box-beta" "sing-box-git") +arch=("x86_64" "armv7h" "aarch64") +url="https://sing-box.sagernet.org/" +_git_url="https://github.com/SagerNet/sing-box" +license=("GPL-3.0-or-later") +backup=("etc/sing-box/config.json") +source_x86_64=("sing-box_${_pkgver}_linux_x86_64.pkg.tar.zst::$_git_url/releases/download/v$_pkgver/sing-box_${_pkgver}_linux_x86_64.pkg.tar.zst") +source_armv7h=("sing-box_${_pkgver}_linux_armv7h.pkg.tar.zst::$_git_url/releases/download/v$_pkgver/sing-box_${_pkgver}_linux_armv7hl.pkg.tar.zst") +source_aarch64=("sing-box_${_pkgver}_linux_aarch64.pkg.tar.zst::$_git_url/releases/download/v$_pkgver/sing-box_${_pkgver}_linux_aarch64.pkg.tar.zst") +sha256sums_x86_64=("8a8b14e5d8c08e555dadb25f8e7b209716c10873c4bbb44c85a29e93660a068e") +sha256sums_armv7h=("fb5d8dbf80484d540eee5501a1e9893b3a32e49d87e670a37ae2818272d87f8b") +sha256sums_aarch64=("6ce4c93e8db0189225439f0efc782c7b57e7720b069ca8c19cf51b73b2056160") +noextract=("${source_x86_64[@]%%::*}" "${source_armv7h[@]%%::*}" "${source_aarch64[@]%%::*}") + +package() { + bsdtar -C $pkgdir --exclude '.*' --zstd -xf "sing-box_${_pkgver}_linux_$CARCH.pkg.tar.zst" +}
\ No newline at end of file |
