Skip to content

Commit

Permalink
Add workflow to update aur repo automatically (#63)
Browse files Browse the repository at this point in the history
* ci: Add workflow to auto update aur

* ci: rename publish-aur and add trigger
  • Loading branch information
horror-proton authored Oct 5, 2023
1 parent b96857a commit f21ce02
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/publish-aur.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish AUR Package

on:
release:
types: [published]
workflow_dispatch:
inputs:
pkgver:
required: false
type: string
pkgrel:
default: 1
required: false
type: number
dryrun:
description: 'Do not push changes to aur'
default: true
required: true
type: boolean

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
container:
image: archlinux:base-devel

steps:
- name: Upgrade system
run: |
pacman -Syu --needed --noconfirm git openssh pacman-contrib namcap
sed -i '/E_ROOT/d' /usr/bin/makepkg
- name: Setup ssh
run: |
mkdir -vpm700 ~root/.ssh && cd "$_"
install -m700 <(echo '${{ secrets.AUR_SSH_PRIVATE_KEY }}') id_rsa
install -m700 <(ssh-keyscan -H aur.archlinux.org) known_hosts
- name: Fetch from aur
run: |
git clone ssh://[email protected]/maa-cli.git
- name: Patch pkgver
run: |
cd maa-cli
ref=${{ inputs.pkgver || github.ref }}
sed -i "/^pkgver=/cpkgver=${ref#refs/tags/v}" PKGBUILD
sed -i "/^pkgrel=/cpkgrel=${{ inputs.pkgrel || 1 }}" PKGBUILD
- name: Makepkg
run: |
cd maa-cli
updpkgsums
makepkg -s --noconfirm
namcap *.pkg.tar.zst
makepkg --printsrcinfo > .SRCINFO
- name: Commit changes
run: |
cd maa-cli
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
echo '```diff' >> $GITHUB_STEP_SUMMARY
git diff --staged >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git commit -m "github-actions[bot]: Upgrade to ${{ inputs.pkgver || github.ref_name }}"
git push origin --verbose ${{ inputs.dryrun && '--dry-run' || '' }}
- uses: actions/upload-artifact@v3
with:
name: package
path: maa-cli/*.pkg.tar.zst

0 comments on commit f21ce02

Please sign in to comment.