ci: add workflow to auto-update pkgver in moonarch-pkgbuilds
Some checks failed
Update PKGBUILD version / update-pkgver (push) Failing after 1m23s
Some checks failed
Update PKGBUILD version / update-pkgver (push) Failing after 1m23s
This commit is contained in:
parent
e59ed53d7a
commit
069387761b
56
.gitea/workflows/update-pkgver.yaml
Normal file
56
.gitea/workflows/update-pkgver.yaml
Normal file
@ -0,0 +1,56 @@
|
||||
# ABOUTME: Updates pkgver in moonarch-pkgbuilds after a push to main.
|
||||
# ABOUTME: Ensures paru detects new versions of this package.
|
||||
|
||||
name: Update PKGBUILD version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
update-pkgver:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout source repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get pkgver from git describe
|
||||
id: version
|
||||
run: |
|
||||
PKGVER=$(git describe --long --tags | sed 's/^v//;s/-/.r/;s/-/./')
|
||||
echo "pkgver=$PKGVER" >> "$GITHUB_OUTPUT"
|
||||
echo "New pkgver: $PKGVER"
|
||||
|
||||
- name: Checkout moonarch-pkgbuilds
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: nevaforget/moonarch-pkgbuilds
|
||||
token: ${{ secrets.PKGBUILD_TOKEN }}
|
||||
path: pkgbuilds
|
||||
|
||||
- name: Update pkgver in PKGBUILD
|
||||
run: |
|
||||
PKGBUILD="pkgbuilds/moonset-git/PKGBUILD"
|
||||
OLD_VER=$(grep '^pkgver=' "$PKGBUILD" | cut -d= -f2)
|
||||
NEW_VER="${{ steps.version.outputs.pkgver }}"
|
||||
|
||||
if [ "$OLD_VER" = "$NEW_VER" ]; then
|
||||
echo "pkgver already up to date ($NEW_VER)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sed -i "s/^pkgver=.*/pkgver=$NEW_VER/" "$PKGBUILD"
|
||||
echo "Updated pkgver: $OLD_VER → $NEW_VER"
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
cd pkgbuilds
|
||||
git config user.name "pkgver-bot"
|
||||
git config user.email "gitea@moonarch.de"
|
||||
git diff --quiet && exit 0
|
||||
git add moonset-git/PKGBUILD
|
||||
git commit -m "chore(moonset-git): bump pkgver to ${{ steps.version.outputs.pkgver }}"
|
||||
git push
|
||||
Loading…
x
Reference in New Issue
Block a user