Update workflow for publishing releases

This commit is contained in:
Lennard Kittner
2026-03-16 18:50:38 +01:00
parent 6c482c11c9
commit ad9422ade7
2 changed files with 102 additions and 41 deletions

View File

@@ -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

102
.github/workflows/publish-release.yml vendored Normal file
View File

@@ -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