Skip to content

pacvis-git: bump to 0.2.7.r12.g34f7494-2 #106

pacvis-git: bump to 0.2.7.r12.g34f7494-2

pacvis-git: bump to 0.2.7.r12.g34f7494-2 #106

Workflow file for this run

name: "Update AUR"
on:
push:
#schedule:
#- cron: "0 0 * * *"
workflow_dispatch:
jobs:
generate-matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate matrix
id: gen-matrix
run: echo "packages=$(ls */ -d | cut -f1 -d'/' | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT"
outputs:
packages: ${{ steps.gen-matrix.outputs.packages }}
aur:
runs-on: ubuntu-latest
needs: generate-matrix
strategy:
fail-fast: false
matrix:
pkgname: ${{ fromJson(needs.generate-matrix.outputs.packages) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Check PKGBUILD
id: build-test
uses: ouuan/pkgbuild-action@v1.2.0
with:
path: ${{ matrix.pkgname }}
- name: Handle epoch
id: epoch
run: |
oldname="${{ steps.build-test.outputs.pkgfile }}"
newname="$(echo "$oldname" | sed -e 's/[^A-Za-z0-9._-]/_/g')"
if [[ "$oldname" != "$newname" ]]; then
mv "$oldname" "$newname"
fi
echo "pkgfile=$newname" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pkgname }}-${{ github.run_id }}
path: ${{ steps.epoch.outputs.pkgfile }}
- name: Clone AUR and update
run: |
message="$(git log -n1 --pretty='%B' "${{ matrix.pkgname }}")"
git clone ssh://aur@aur.archlinux.org/${{ matrix.pkgname }}.git ../aur
shopt -s dotglob
shopt -s extglob
rm ../aur/!(.git|.|..) || true
cp -r ${{ matrix.pkgname }}/* ../aur
cd ../aur
git config user.name "GitHub Action"
git config user.email "action@github.com"
git add -A
escape() {
local content="$1"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "$content"
}
git diff-index @ --exit-code --quiet || ( git commit -m "Update from GitHub Actions: $message
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" && echo "::warning::Pushed to AUR:%0A$(escape "$message")" )
git push