Add GitHub Actions workflow for AUR package publishing

This commit is contained in:
Nihal Kumar
2025-02-22 15:28:55 +05:30
parent 528ca231c2
commit e7bab652dc

75
.github/workflows/aur-publish.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: Update AUR Package
on:
push:
tags:
- 'v*'
paths:
- 'pubspec.yaml'
jobs:
aur-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from pubspec
id: get_version
run: |
VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Get checksums
id: get_checksums
run: |
# Download the .deb file
wget https://github.com/foss42/apidash/releases/download/v${{ steps.get_version.outputs.version }}/apidash-linux-amd64.deb
# Download the LICENSE file
wget https://raw.githubusercontent.com/foss42/apidash/main/LICENSE
# Generate SHA512 checksums
DEB_CHECKSUM=$(sha512sum apidash-linux-amd64.deb | awk '{print $1}')
LICENSE_CHECKSUM=$(sha512sum LICENSE | awk '{print $1}')
echo "deb_checksum=$DEB_CHECKSUM" >> $GITHUB_OUTPUT
echo "license_checksum=$LICENSE_CHECKSUM" >> $GITHUB_OUTPUT
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
with:
pkgname: apidash-bin
pkgbuild: |
# Maintainer: Angelo Geulin <angelogeulin123 at gmail dot com>
pkgname=apidash-bin
pkgver=${{ steps.get_version.outputs.version }}
pkgrel=1
pkgdesc="Beautiful open-source cross-platform API Client"
arch=('x86_64')
url="https://apidash.dev"
license=('Apache-2.0')
depends=()
options=('!emptydirs' '!strip')
source=("https://github.com/foss42/apidash/releases/download/v${pkgver}/apidash-linux-amd64.deb"
'LICENSE')
sha512sums=('${{ steps.get_checksums.outputs.deb_checksum }}'
'${{ steps.get_checksums.outputs.license_checksum }}')
package() {
bsdtar -xf data.tar.zst -C "$pkgdir/"
# Fix permissions of directories.
find "$pkgdir/" -type d -exec chmod 755 {} \;
# Create a symlink inside the /usr/bin directory.
mkdir -p "${pkgdir}/usr/bin"
ln -s /usr/share/apidash/apidash "$pkgdir/usr/bin/apidash"
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/apidash/LICENSE
}
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "Update to version ${{ steps.get_version.outputs.version }}"