Skip to content

Update AUR

Update AUR #93

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: Release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
tag: "packages"
commit: master
artifacts: "./*.zst"
token: ${{ secrets.GITHUB_TOKEN }}
- 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