fix PKGBUILD install #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deployment | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: test | |
| env: | |
| ARTIFACT_DIR: artifact | |
| BINARY_NAME: baru-linux-x86_64 | |
| outputs: | |
| sha256: ${{ steps.gen_sha256.outputs.sha256 }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies | |
| run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev | |
| - name: Build | |
| run: cargo build --release --locked | |
| - name: Prepare artifact | |
| run: | | |
| mkdir ${{ env.ARTIFACT_DIR }} | |
| mv -f target/release/baru ${{ env.ARTIFACT_DIR }}/${{ env.BINARY_NAME }} | |
| cd ${{ env.ARTIFACT_DIR }} | |
| sha256sum ${{ env.BINARY_NAME }} > ${{ env.BINARY_NAME }}.sha256sum | |
| ls -lh | |
| - name: Print build info | |
| run: | | |
| echo "--------------------------------------------" | |
| echo "binary name: ${{ env.BINARY_NAME }}" | |
| echo "sha256sum: $(cat ${{ env.ARTIFACT_DIR }}/${{ env.BINARY_NAME }}.sha256sum)" | |
| echo "file size: $(du -h ${{ env.ARTIFACT_DIR }}/${{ env.BINARY_NAME }} | cut -f1)" | |
| echo "--------------------------------------------" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: baru-linux-x86_64 | |
| path: ${{ env.ARTIFACT_DIR }} | |
| retention-days: 7 | |
| if-no-files-found: error | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download binary artifact | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: baru-linux-x86_64 | |
| path: artifacts | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ github.ref_name }} | |
| files: | | |
| artifacts/* | |
| aur-packaging: | |
| name: Publish AUR package | |
| needs: release | |
| runs-on: ubuntu-latest | |
| env: | |
| PKGBUILD: ./.pkg/arch/PKGBUILD | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get tarball sha256sum | |
| id: tarball | |
| run: | | |
| curl -LfsSo sources.tar.gz "https://github.com/doums/baru/archive/refs/tags/${{ github.ref_name }}.tar.gz" | |
| sha256sum=$(sha256sum sources.tar.gz | awk '{print $1}') | |
| echo "tarball sha256sum: $sha256sum" | |
| echo "sha256sum=$sha256sum" >> "$GITHUB_OUTPUT" | |
| - name: Update PKGBUILD | |
| env: | |
| RELEASE_TAG: ${{ github.ref_name }} | |
| SHA256SUM: ${{ steps.tarball.outputs.sha256sum }} | |
| run: | | |
| # strip v prefix | |
| version="${RELEASE_TAG#v}" | |
| # ⚠ Dashes are not allowed in package version, replace any - by _ | |
| pkgver=${version//-/_} | |
| echo "pkgver: $pkgver" | |
| # update version and sha256sum | |
| sed -i "s/pkgver=.*/pkgver=$pkgver/" ${{ env.PKGBUILD }} | |
| sed -i "s/sha256sums=(.*)/sha256sums=('$SHA256SUM')/" ${{ env.PKGBUILD }} | |
| echo "--------------------------------------------" | |
| cat ${{ env.PKGBUILD }} | |
| - name: Publish | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.2 | |
| with: | |
| pkgname: baru | |
| pkgbuild: ${{ env.PKGBUILD }} | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_KEY }} | |
| commit_message: ${{ github.ref_name }} |