nodejs-mocha: update to 11.0.1-1 #927
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update AUR" | |
on: | |
push: | |
schedule: | |
- cron: "0 0 * * 6" | |
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@master | |
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://[email protected]/${{ 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 "[email protected]" | |
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 |