Skip to content

Commit

Permalink
feat(ci): add AUR release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bloznelis committed Oct 13, 2024
1 parent 73424fc commit 42adb87
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/aur/PKGBUILD.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Maintainer: Energi <lukas.bloznelis@gmail.com>

pkgname=krowbar
pkgver=${PKGVER}
pkgrel=1
pkgdesc="BSPWM status bar"
arch=(x86_64)
url="https://github.com/bloznelis/krowbar"
license=(MIT)
groups=()
depends=(gtk4)
makedepends=(git cargo)
provides=("$pkgname")
conflicts=("$pkgname")
source=("git+$url")
source=("$url/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('SKIP')

build() {
cd "${pkgname}-${pkgver}"
cargo build --release
}

check() {
cd "${pkgname}-${pkgver}"
cargo check
}

package() {
cd "${pkgname}-${pkgver}"
install -Dm755 target/release/$pkgname "$pkgdir/usr/bin/$pkgname"
install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
16 changes: 16 additions & 0 deletions .github/aur/SRCINFO.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pkgbase = krowbar
pkgdesc = BSPWM status bar
pkgver = ${PKGVER}
pkgrel = 1
url = https://github.com/bloznelis/krowbar
arch = x86_64
license = MIT
makedepends = git
makedepends = cargo
depends = gtk4
provides = krowbar
conflicts = krowbar
source = https://github.com/bloznelis/krowbar/archive/refs/tags/${PKGVER}.tar.gz
sha256sums = SKIP

pkgname = krowbar
25 changes: 25 additions & 0 deletions .github/aur/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e

WD=$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)
ROOT=${WD%/.github/aur}

export VERSION=$1

echo "Publishing to AUR as version ${VERSION}"

cd $WD
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
rm -rf .pkg
git clone ssh://aur@aur.archlinux.org/krowbar.git .pkg 2>&1
export PKGVER=$VERSION

envsubst '$PKGVER' < SRCINFO.template > .pkg/.SRCINFO
envsubst '$PKGVER' < PKGBUILD.template > .pkg/PKGBUILD

cd .pkg
git config user.name "bloznelis"
git config user.email "lukas.bloznelis@gmail.com"
git add -A
git commit -m "Release $VERSION"
git push origin master
20 changes: 20 additions & 0 deletions .github/workflows/aur.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: AUR release

on:
push:
tags: "*"

jobs:
aur:
name: Release to AUR
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.AUR_SSH_KEY }}
known_hosts: unnecessary
- name: Push to AUR
run: .github/aur/publish.sh ${{ github.ref_name }}

0 comments on commit 42adb87

Please sign in to comment.