diff --git a/.github/workflows/aur-publish.yml b/.github/workflows/aur-publish.yml new file mode 100644 index 00000000..77b7820d --- /dev/null +++ b/.github/workflows/aur-publish.yml @@ -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 + + 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 }}"