|
| 1 | +name: Update AUR Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + paths: |
| 8 | + - 'pubspec.yaml' |
| 9 | + |
| 10 | +jobs: |
| 11 | + aur-publish: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Get version from pubspec |
| 18 | + id: get_version |
| 19 | + run: | |
| 20 | + VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1) |
| 21 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 22 | +
|
| 23 | + - name: Get checksums |
| 24 | + id: get_checksums |
| 25 | + run: | |
| 26 | + # Download the .deb file |
| 27 | + wget https://github.com/foss42/apidash/releases/download/v${{ steps.get_version.outputs.version }}/apidash-linux-amd64.deb |
| 28 | + |
| 29 | + # Download the LICENSE file |
| 30 | + wget https://raw.githubusercontent.com/foss42/apidash/main/LICENSE |
| 31 | + |
| 32 | + # Generate SHA512 checksums |
| 33 | + DEB_CHECKSUM=$(sha512sum apidash-linux-amd64.deb | awk '{print $1}') |
| 34 | + LICENSE_CHECKSUM=$(sha512sum LICENSE | awk '{print $1}') |
| 35 | + |
| 36 | + echo "deb_checksum=$DEB_CHECKSUM" >> $GITHUB_OUTPUT |
| 37 | + echo "license_checksum=$LICENSE_CHECKSUM" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + - name: Publish AUR package |
| 40 | + |
| 41 | + with: |
| 42 | + pkgname: apidash-bin |
| 43 | + pkgbuild: | |
| 44 | + # Maintainer: Angelo Geulin <angelogeulin123 at gmail dot com> |
| 45 | + |
| 46 | + pkgname=apidash-bin |
| 47 | + pkgver=${{ steps.get_version.outputs.version }} |
| 48 | + pkgrel=1 |
| 49 | + pkgdesc="Beautiful open-source cross-platform API Client" |
| 50 | + arch=('x86_64') |
| 51 | + url="https://apidash.dev" |
| 52 | + license=('Apache-2.0') |
| 53 | + depends=() |
| 54 | + options=('!emptydirs' '!strip') |
| 55 | + source=("https://github.com/foss42/apidash/releases/download/v${pkgver}/apidash-linux-amd64.deb" |
| 56 | + 'LICENSE') |
| 57 | + sha512sums=('${{ steps.get_checksums.outputs.deb_checksum }}' |
| 58 | + '${{ steps.get_checksums.outputs.license_checksum }}') |
| 59 | + |
| 60 | + package() { |
| 61 | + bsdtar -xf data.tar.zst -C "$pkgdir/" |
| 62 | + |
| 63 | + # Fix permissions of directories. |
| 64 | + find "$pkgdir/" -type d -exec chmod 755 {} \; |
| 65 | + |
| 66 | + # Create a symlink inside the /usr/bin directory. |
| 67 | + mkdir -p "${pkgdir}/usr/bin" |
| 68 | + ln -s /usr/share/apidash/apidash "$pkgdir/usr/bin/apidash" |
| 69 | + |
| 70 | + install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/apidash/LICENSE |
| 71 | + } |
| 72 | + commit_username: ${{ secrets.AUR_USERNAME }} |
| 73 | + commit_email: ${{ secrets.AUR_EMAIL }} |
| 74 | + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} |
| 75 | + commit_message: "Update to version ${{ steps.get_version.outputs.version }}" |
0 commit comments