lmdbal/.gitea/workflows/aur.yml

81 lines
2.9 KiB
YAML
Raw Normal View History

2024-10-28 12:11:30 +00:00
name: Release to AUR
on:
workflow_call:
inputs:
package-name:
required: true
type: string
description:
required: true
type: string
depends:
required: true
type: string
2024-11-30 17:30:19 +00:00
flags:
required: true
type: string
2024-10-28 12:11:30 +00:00
workflow_dispatch:
inputs:
package-name:
description: "The name under which the package is going to be packaged to AUR"
type: string
default: "lmdbal"
description:
description: "The description of the package"
type: string
default: "LMDB Abstraction Layer"
depends:
description: "Additional dependencies"
type: string
default: ""
2024-11-30 17:30:19 +00:00
flags:
description: "Additional CMake flags"
type: string
default: ""
2024-10-28 12:11:30 +00:00
jobs:
aur:
2024-11-30 17:30:19 +00:00
name: Releasing ${{ inputs.package-name }} to AUR
2024-10-28 12:11:30 +00:00
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 }}
2024-11-30 21:17:52 +00:00
git checkout -b master || git checkout master
2024-10-28 12:11:30 +00:00
- 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
2024-11-30 20:46:09 +00:00
sed -i "/pkgname=lmdbal/c\pkgname=${{ inputs.package-name }}" PKGBUILD
sed -i "/pkgver=1.0.0/c\pkgver=${{ gitea.event.release.tag_name }}" PKGBUILD
sed -i "/pkgdesc=\"LMDB Abstraction Layer\"/c\pkgdesc=\"${{ inputs.description }}\"" PKGBUILD
sed -i "/depends=( 'lmdb' )/c\depends=( 'lmdb' ${{ inputs.depends }} )" PKGBUILD
2024-11-30 21:07:49 +00:00
sed -i '/cmake . -D/s/$/ ${{ inputs.flags }}/' PKGBUILD
2024-10-28 12:11:30 +00:00
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 }}"
2024-11-30 21:17:52 +00:00
GIT_SSH_COMMAND="ssh -i ../key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git push origin master