diff options
Diffstat (limited to '.github/workflows/update-pkgbuilds.yml')
| -rw-r--r-- | .github/workflows/update-pkgbuilds.yml | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/.github/workflows/update-pkgbuilds.yml b/.github/workflows/update-pkgbuilds.yml index 1958f98..a99d738 100644 --- a/.github/workflows/update-pkgbuilds.yml +++ b/.github/workflows/update-pkgbuilds.yml @@ -284,3 +284,65 @@ jobs: git add repo/rathole/PKGBUILD git commit -m "feat(pkg): Update rathole to ${VERSION}" git push || (git pull --rebase && git push) + + update-zsign-bin: + name: Update zsign-bin + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v7 + + - name: Get latest release version + id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION=$(gh api repos/zhlynn/zsign/releases/latest \ + --jq '.tag_name | ltrimstr("v")') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Check current version + id: check + run: | + CURRENT=$(grep '^pkgver=' repo/zsign-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 asset and compute sha256sum + if: steps.check.outputs.skip == 'false' + id: sums + env: + VERSION: ${{ steps.version.outputs.version }} + GIT_URL: https://github.com/zhlynn/zsign + run: | + FILE="zsign-linux-x86_64.tar.gz" + wget -q "$GIT_URL/releases/download/v${VERSION}/$FILE" -O "$FILE" + SUM=$(sha256sum "$FILE" | awk '{print $1}') + echo "sha256=$SUM" >> "$GITHUB_OUTPUT" + rm "$FILE" + + - name: Update PKGBUILD + if: steps.check.outputs.skip == 'false' + env: + VERSION: ${{ steps.version.outputs.version }} + SHA256: ${{ steps.sums.outputs.sha256 }} + run: | + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" repo/zsign-bin/PKGBUILD + sed -i "s/^pkgrel=.*/pkgrel=1/" repo/zsign-bin/PKGBUILD + sed -i "0,/^sha256sums=/s|^sha256sums=(.*|sha256sums=('${SHA256}'|" repo/zsign-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/zsign-bin/PKGBUILD + git commit -m "feat(pkg): Update zsign-bin to ${VERSION}" + git push || (git pull --rebase && git push) |
