update-pkgbuilds #985
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-pkgbuilds | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 7,13 * * *" | |
jobs: | |
assemble_matrices: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Assemble matrices | |
id: assemble_matrices | |
run: | | |
echo "::set-output name=package_matrix::$(python -c "import os, json; print(json.dumps([f for f in os.listdir('.') if os.path.isdir(f) and os.path.isfile(os.path.join(f, 'PKGBUILD'))]))")" | |
outputs: | |
package_matrix: ${{ steps.assemble_matrices.outputs.package_matrix }} | |
update: | |
runs-on: ubuntu-latest | |
container: archlinux:base-devel | |
needs: assemble_matrices | |
strategy: | |
matrix: | |
package: ${{ fromJson(needs.assemble_matrices.outputs.package_matrix) }} | |
steps: | |
- name: Update system and install additional packages | |
run: pacman -Syyu --noconfirm git jq pacman-contrib | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Adding working directory to the git global config as a safe directory | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Update package ${{ matrix.package }} | |
run: | | |
if [ ! -d "./${{ matrix.package }}" ]; then | |
>&2 echo "Package ${{ matrix.package }} does not exist" | |
exit 1 | |
fi | |
if [ -x "./.github/scripts/${{ matrix.package }}.sh" ]; then | |
./.github/scripts/${{ matrix.package }}.sh | |
else | |
>&2 echo "./.github/scripts/${{ matrix.package }}.sh not found or not executable" | |
exit 2 | |
fi | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
branch: update-pkgbuild/${{ matrix.package }} | |
delete-branch: true | |
author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> | |
committer: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> | |
title: "chore(${{ matrix.package }}): bump version to ${{ env.LATEST_VERSION }}" | |
commit-message: "chore(${{ matrix.package }}): bump version to ${{ env.LATEST_VERSION }}" | |
body: "" |