Update arch_pkgs.yml #67
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: PKGBUILD CI | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
# Required permissions | |
permissions: | |
pull-requests: read | |
# Set job outputs to values from filter step | |
outputs: | |
pgkbuild: ${{ steps.filter.outputs.pgkbuild }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
pkgbuild: | |
- arch_pkgs/** | |
build-packages: | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
[ | |
c, | |
rust, | |
rism-gui | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build ${{ matrix.package }} PKGBUILD | |
id: makepkg | |
uses: edlanglois/pkgbuild-action@v1 | |
with: | |
pkgdir: arch_pkgs/${{ matrix.package }} | |
aurDeps: true | |
- name: Print Package Files | |
run: | | |
echo "Successfully created the following package archive" | |
echo "Package: ${{ steps.makepkg.outputs.pkgfile0 }}" | |
echo "Package: ${{ steps.makepkg.outputs.pkgfile1 }}" | |
- name: Upload Package Archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pkgfiles | |
path: | | |
${{ steps.makepkg.outputs.pkgfile0 }} | |
${{ steps.makepkg.outputs.pkgfile1 }} | |
publish-to-repo: | |
if: ${{ github.event_name != 'pull_request'}} | |
runs-on: ubuntu-latest | |
needs: [build-packages, changes] | |
container: | |
image: archlinux:base-devel | |
steps: | |
- name: Install dependencies | |
run: | | |
pacman -Syu --noconfirm | |
pacman -S --noconfirm git | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'neferin12/repos' | |
ref: 'main' | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Download packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: pkgfiles | |
path: /tmp/pkgfiles | |
- name: Add packages to repo | |
run: | | |
cp -f /tmp/pkgfiles/* ./arch/x86_64/ | |
cd arch/x86_64 | |
repo-add -p -R pollinger.db.tar.gz *.pkg.tar.zst | |
- name: Commit changes | |
run: | | |
git config --global --add safe.directory $(pwd) | |
git add arch | |
git config --global user.name 'GitHub Actions [Bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git commit -am "Updated packages" | |
git push | |
publish-to-gitea-repo: | |
if: ${{ github.event_name != 'pull_request'}} | |
runs-on: ubuntu-latest | |
needs: [build-packages, changes] | |
container: | |
image: archlinux:base-devel | |
steps: | |
- name: Install dependencies | |
run: | | |
pacman -Syu --noconfirm | |
pacman -S --noconfirm git git-lfs | |
- name: Download packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: pkgfiles | |
path: /tmp/pkgfiles | |
- name: Clone repo | |
env: | |
EXTERNAL_TOKEN : ${{ secrets.EXTERNAL_TOKEN }} | |
run: | | |
git clone https://julian:$EXTERNAL_TOKEN@git.pollinger.dev/julian/repo.git | |
- name: Add packages to repo | |
run: | | |
cd repo | |
cp -f /tmp/pkgfiles/* ./arch/x86_64/ | |
cd arch/x86_64 | |
repo-add -p -R pollinger.db.tar.gz *.pkg.tar.zst | |
- name: Commit changes | |
run: | | |
cd repo | |
git config --global --add safe.directory $(pwd) | |
git add arch | |
git config --global user.name 'GitHub Actions [Bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git commit -am "Updated packages" | |
git push |