diff --git a/.github/workflows/publish-aur-bin.yml b/.github/workflows/publish-aur-bin.yml deleted file mode 100644 index ea57b0c..0000000 --- a/.github/workflows/publish-aur-bin.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Rust - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - - publish-aur: - runs-on: ubuntu-latest - needs: [build-linux, build-macos] - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # needed to get full commit history for rev-list - - - name: Clone AUR repo - run: git clone https://aur.archlinux.org/hyper-headset-git.git aur-pkg - - - name: Compute and update pkgver - run: | - PKGVER=$(git describe --long --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g') - sed -i "s/^pkgver=.*/pkgver=$PKGVER/" aur-pkg/PKGBUILD - sed -i "s/^pkgrel=.*/pkgrel=1/" aur-pkg/PKGBUILD - - - name: Publish to AUR - uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 - - with: - pkgname: hyper-headset-git - pkgbuild: ./aur-pkg/PKGBUILD - commit_username: ${{ secrets.AUR_USERNAME }} - commit_email: ${{ secrets.AUR_EMAIL }} - ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} - commit_message: Automatic update to latest - updpkgsums: false - allow_empty_commits: false diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..5464b10 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,102 @@ +name: Publish release +on: + push: + tags: + - 'v*' + +env: + CARGO_TERM_COLOR: always + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Install Dependencies + run: sudo apt update && sudo apt install -y libdbus-1-dev libhidapi-dev libusb-1.0-0-dev libudev-dev + - name: Build release binaries + run: | + cargo build --release --bin hyper_headset_cli + cargo build --release --bin hyper_headset + - name: Create zip + run: | + mkdir -p dist + cp target/release/hyper_headset dist/ + cp target/release/hyper_headset_cli dist/ + cd dist && zip hyper_headset_Linux.zip hyper_headset hyper_headset_cli + - name: Upload zip artifact + uses: actions/upload-artifact@v4 + with: + name: hyper_headset_Linux + path: dist/hyper_headset_Linux.zip + + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Build release binaries + run: cargo build --release --bin hyper_headset_cli + - name: Create zip + run: | + mkdir -p dist + cp target/release/hyper_headset_cli dist/ + cd dist && zip hyper_headset_MacOS.zip hyper_headset_cli + - name: Upload zip artifact + uses: actions/upload-artifact@v4 + with: + name: hyper_headset_MacOS + path: dist/hyper_headset_MacOS.zip + + publish-aur: + runs-on: ubuntu-latest + needs: [build-linux, build-macos] + steps: + - uses: actions/checkout@v3 + + - name: Download Linux zip artifact + uses: actions/download-artifact@v4 + with: + name: hyper_headset_Linux + path: dist/ + + - name: Download MacOS zip artifact + uses: actions/download-artifact@v4 + with: + name: hyper_headset_MacOS + path: dist/ + + - name: Create GitHub Release and upload zip + uses: softprops/action-gh-release@v2 + with: + prerelease: true + files: | + dist/hyper_headset_Linux.zip + dist/hyper_headset_MacOS.zip + + - name: Get tag version + id: version + run: echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Clone AUR bin repo + run: git clone https://aur.archlinux.org/hyperheadset-bin.git aur-bin-pkg + + - name: Update pkgver and pkgrel + run: | + sed -i "s/^pkgver=.*/pkgver=${{ steps.version.outputs.tag }}/" aur-bin-pkg/PKGBUILD + sed -i "s/^pkgrel=.*/pkgrel=1/" aur-bin-pkg/PKGBUILD + + - name: Publish to AUR + uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 + with: + pkgname: hyper-headset-bin + pkgbuild: ./aur-bin-pkg/PKGBUILD + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: Update to ${{ steps.version.outputs.tag }} + updpkgsums: true + allow_empty_commits: false