Skip to content

Commit

Permalink
Merge pull request #8 from irfanhakim-as/aur
Browse files Browse the repository at this point in the history
Publish to AUR
  • Loading branch information
irfanhakim-as authored Aug 28, 2024
2 parents 8b5b97a + 4118d3b commit 6d791ad
Show file tree
Hide file tree
Showing 4 changed files with 366 additions and 177 deletions.
17 changes: 17 additions & 0 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pkgbase = kf6-service-menu-reimage
pkgdesc = Manipulate images e their metadata
pkgver = 2.6.0
pkgrel = 1
url = https://github.com/irfanhakim-as/kde-service-menu-reimage
arch = any
license = GPL-3.0+
depends = dolphin
depends = imagemagick
depends = kdialog
optdepends = jhead: required for extracting exif data
conflicts = kde-service-menu-reimage
conflicts = kde-service-menu-reimage-mod
source = https://github.com/irfanhakim-as/kde-service-menu-reimage/releases/download/v2.6.0/kde-service-menu-reimage_2.6.0_any.tar.gz
md5sums = acc6ec84363579911b366e62ff79bb22

pkgname = kf6-service-menu-reimage
95 changes: 95 additions & 0 deletions .github/workflows/aur.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Update AUR

on:
push:
branches:
- master # monitor changes only in the master branch
paths:
- PKGBUILD # monitor changes to the PKGBUILD file
workflow_dispatch: # allow manually triggering the workflow

env:
REMOTE_HOST: aur.archlinux.org
REMOTE_HOST_USER: aur
REMOTE_HOST_PREFIX: ssh
REMOTE_REPO_NAMESPACE: ''
REMOTE_REPO_NAME: kf6-service-menu-reimage
REMOTE_REPO_USER: irfanhakim
REMOTE_REPO_EMAIL: [email protected]

jobs:
update-aur:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
id: checkout
uses: actions/checkout@v3

- name: Set up SSH
id: configure_ssh
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.AUR_PRIVATE_KEY }}

- name: Add remote host to known hosts
id: add_remote_host
run: |
ssh-keyscan ${REMOTE_HOST} >> ~/.ssh/known_hosts
- name: Clone the remote repository
id: clone_remote_repo
run: |
# set variables
REMOTE_HOST_PREFIX="${{ env.REMOTE_HOST_PREFIX }}${{ env.REMOTE_HOST_PREFIX && '://' }}"
REMOTE_REPO_NAMESPACE="${{ env.REMOTE_REPO_NAMESPACE && ':' }}${{ env.REMOTE_REPO_NAMESPACE }}"
# clone remote repository
git clone ${REMOTE_HOST_PREFIX}${REMOTE_HOST_USER:-git}@${REMOTE_HOST}${REMOTE_REPO_NAMESPACE}/${REMOTE_REPO_NAME}.git
- name: Copy package files to remote repository
id: copy_pkgfiles
run: |
cp .SRCINFO PKGBUILD ${REMOTE_REPO_NAME}/
- name: Check if package files have changes
id: check_changes
run: |
# change working directory
cd ${REMOTE_REPO_NAME}
# add package files
git add .SRCINFO PKGBUILD
# check for changes
if git diff --cached --exit-code >/dev/null; then
echo "No changes have been made to the package files."
exists=false
else
echo "Package files have been updated and are pending commit."
exists=true
fi
# export result to output
echo "exists=${exists}" | tee -a ${GITHUB_OUTPUT}
- name: Commit and push updated package files
id: push_changes
if: steps.check_changes.outputs.exists == 'true'
run: |
# set variables
source PKGBUILD
version="${pkgver}"
release="${pkgrel}"
# change working directory
cd ${REMOTE_REPO_NAME}
# configure git
git config --local user.name "${REMOTE_REPO_USER:-github-actions[bot]}"
git config --local user.email "${REMOTE_REPO_EMAIL:-github-actions[bot]@users.noreply.github.com}"
# commit changes
git commit -m "Update to ${version}-${pkgrel}"
# push commit
git push -u origin HEAD
Loading

0 comments on commit 6d791ad

Please sign in to comment.