-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: custom release profile options
- Loading branch information
Showing
10 changed files
with
354 additions
and
100 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Deployment | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
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: Upload binary artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: baru | ||
path: ./target/release/baru | ||
|
||
gh-release: | ||
name: Publish Github Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Download binary artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: baru | ||
path: ./target/release/ | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: target/release/baru | ||
|
||
aur-packaging: | ||
name: Publish AUR package | ||
needs: gh-release | ||
runs-on: ubuntu-latest | ||
env: | ||
PKG_NAME: baru | ||
PKGBUILD: ./.pkg/aur/PKGBUILD | ||
RELEASE_TAG: ${{ github.ref_name }} | ||
REPOSITORY: ${{ github.repository }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Download sources | ||
run: curl -LfsSo "$PKG_NAME-$RELEASE_TAG".tar.gz "https://github.com/$REPOSITORY/archive/refs/tags/$RELEASE_TAG.tar.gz" | ||
- name: Update PKGBUILD | ||
run: ./.pkg/aur/update.sh | ||
- name: Show PKGBUILD | ||
run: cat "$PKGBUILD" | ||
- name: Publish | ||
uses: KSXGitHub/[email protected] | ||
with: | ||
pkgname: ${{ env.PKG_NAME }} | ||
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 }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Test | ||
|
||
on: [push, workflow_call, pull_request] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
components: clippy | ||
- name: Install dependencies | ||
run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev | ||
- name: Lint | ||
run: cargo clippy | ||
- name: Check | ||
run: cargo check | ||
- name: Test | ||
run: cargo test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Maintainer: Pierre Dommerc <[email protected]> | ||
|
||
pkgname=baru | ||
pkgver=0.1.0 | ||
pkgrel=1 | ||
pkgdesc='A system monitor written in Rust and C' | ||
arch=('x86_64') | ||
url='https://github.com/doums/baru' | ||
license=('MPL2') | ||
depends=('libpulse') | ||
makedepends=('rust' 'cargo') | ||
provides=('baru') | ||
conflicts=('baru') | ||
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz") | ||
sha256sums=('xxx') | ||
|
||
build() { | ||
cd "$pkgname-$pkgver" | ||
cargo build --release --locked | ||
} | ||
|
||
package() { | ||
cd "$pkgname-$pkgver" | ||
install -Dvm 755 "target/release/baru" "$pkgdir/usr/bin/baru" | ||
install -Dvm 644 "baru.yaml" "$pkgdir/usr/share/baru/baru.yaml" | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#! /bin/bash | ||
|
||
# script to bump version and update sources hash of a PKGBUILD | ||
|
||
set -e | ||
|
||
red="\e[38;5;1m" | ||
green="\e[38;5;2m" | ||
bold="\e[1m" | ||
reset="\e[0m" | ||
|
||
if [ -z "$PKGBUILD" ]; then | ||
>&2 printf " %b%b✕%b PKGBUILD not set\n" "$red" "$bold" "$reset" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$PKG_NAME" ]; then | ||
>&2 printf " %b%b✕%b PKG_NAME not set\n" "$red" "$bold" "$reset" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$RELEASE_TAG" ]; then | ||
>&2 printf " %b%b✕%b RELEASE_TAG not set\n" "$red" "$bold" "$reset" | ||
exit 1 | ||
fi | ||
|
||
if ! [ -a "$PKGBUILD" ]; then | ||
>&2 printf " %b%b✕%b no such file $PKGBUILD\n" "$red" "$bold" "$reset" | ||
exit 1 | ||
fi | ||
|
||
if ! [[ "$RELEASE_TAG" =~ ^v.*? ]]; then | ||
>&2 printf " %b%b✕%b invalid tag $RELEASE_TAG\n" "$red" "$bold" "$reset" | ||
exit 1 | ||
fi | ||
|
||
pkgver="${RELEASE_TAG#v}" | ||
tarball="$PKG_NAME-$RELEASE_TAG".tar.gz | ||
|
||
if ! [ -a "$tarball" ]; then | ||
>&2 printf " %b%b✕%b no such file $tarball\n" "$red" "$bold" "$reset" | ||
exit 1 | ||
fi | ||
|
||
# bump package version | ||
sed -i "s/pkgver=.*/pkgver=$pkgver/" "$PKGBUILD" | ||
printf " %b%b✓%b bump version to $RELEASE_TAG\n" "$green" "$bold" "$reset" | ||
|
||
# generate new checksum | ||
sum=$(set -o pipefail && sha256sum "$tarball" | awk '{print $1}') | ||
sed -i "s/sha256sums=('.*')/sha256sums=('$sum')/" "$PKGBUILD" | ||
printf " %b%b✓%b generated checksum $sum\n" "$green" "$bold" "$reset" | ||
|
||
exit 0 |
Oops, something went wrong.