From 4fd3799c1912cd1c8cd87c5924728c5f5821707d Mon Sep 17 00:00:00 2001 From: blue Date: Mon, 28 Oct 2024 14:11:30 +0200 Subject: [PATCH] Playing with CI --- .gitea/workflows/aur.yml | 80 ++++++++++++++++++++++++++++++++++++ packaging/Archlinux/PKGBUILD | 6 +-- 2 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 .gitea/workflows/aur.yml diff --git a/.gitea/workflows/aur.yml b/.gitea/workflows/aur.yml new file mode 100644 index 0000000..bdd6e32 --- /dev/null +++ b/.gitea/workflows/aur.yml @@ -0,0 +1,80 @@ +name: Release to AUR +on: + workflow_call: + inputs: + package-name: + required: true + type: string + version: + required: true + type: string + description: + required: true + type: string + depends: + required: true + type: string + workflow_dispatch: + inputs: + package-name: + description: "The name under which the package is going to be packaged to AUR" + type: string + default: "lmdbal" + version: + description: "The version of the published package" + type: string + default: "1.0.0" + description: + description: "The description of the package" + type: string + default: "LMDB Abstraction Layer" + depends: + description: "Additional dependencies" + type: string + default: "" + +jobs: + aur: + name: Release ${{ inputs.package-name }} to AUR + runs-on: archlinux + steps: + - name: Download the release tarball + run: curl -sL ${{ gitea.server_url }}/${{ gitea.repository }}/archive/${{ gitea.event.release.tag_name }}.tar.gz --output tarball.tar.gz + + - name: Calculate SHA256 for the tarball + run: echo "tbSum=$(sha256sum tarball.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV + + - name: Unarchive tarball + run: tar -xvzf tarball.tar.gz + + - name: Clone the AUR repository + run: | + echo "${{ secrets.DEPLOY_TO_AUR_PRIVATE_KEY }}" > key + chmod 600 key + GIT_SSH_COMMAND="ssh -i key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git clone ssh://aur@aur.archlinux.org/${{ inputs.package-name }}.git aur + chmod 777 -R aur + cd aur + git config user.name ${{ secrets.DEPLOY_TO_AUR_USER_NAME }} + git config user.email ${{ secrets.DEPLOY_TO_AUR_EMAIL }} + + + - name: Copy PKGBUILD to the directory + run: cp lmdbal/packaging/Archlinux/PKGBUILD aur/ + + - name: Patch PKGBUILD file, and generate .SRCINFO + working-directory: aur + run: | + sed -i "/sha256sums=/c\sha256sums=('${{ env.tbSum }}')" PKGBUILD + sed -i "/pkgname=lmdbal/c\pkgname=(${{ inputs.package-name }})" PKGBUILD + sed -i "/pkgver=1.0.0/c\pkgver=(${{ inputs.version }})" PKGBUILD + sed -i "/pkgdesc=\"LMDB Abstraction Layer\"/c\pkgdesc=(\"${{ inputs.description }}\")" PKGBUILD + sed -i "/depends=( 'lmdb' )/c\depends=( 'lmdb' ${{ inputs.depends }} ))" PKGBUILD +# sed -i "/pkgname=lmdbal/c\pkgname=('${{ gitea.event.release.tag_name }}')" PKGBUILD + sudo -u build makepkg --printsrcinfo > .SRCINFO + + - name: Commit package to aur + working-directory: aur + run: | + git add PKGBUILD .SRCINFO + git commit -m "${{ gitea.event.release.body }}" + GIT_SSH_COMMAND="ssh -i ../key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git push diff --git a/packaging/Archlinux/PKGBUILD b/packaging/Archlinux/PKGBUILD index 0f4b0da..d8e2277 100644 --- a/packaging/Archlinux/PKGBUILD +++ b/packaging/Archlinux/PKGBUILD @@ -1,12 +1,12 @@ # Maintainer: Yury Gubich pkgname=lmdbal -pkgver=0.5.4 +pkgver=1.0.0 pkgrel=1 -pkgdesc="LMDB Abstraction Layer, qt5 version" +pkgdesc="LMDB Abstraction Layer" arch=('i686' 'x86_64') url="https://git.macaw.me/blue/lmdbal" license=('GPL3') -depends=( 'lmdb' 'qt5-base') +depends=( 'lmdb' ) makedepends=('cmake>=3.16' 'gcc') optdepends=()