-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
243 additions
and
77 deletions.
There are no files selected for viewing
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 libnotify | ||
run: sudo apt-get install libnotify-dev | ||
- name: Build | ||
run: cargo build --release --locked | ||
- name: Upload binary artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: bato | ||
path: ./target/release/bato | ||
|
||
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: bato | ||
path: ./target/release/ | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: target/release/bato | ||
|
||
aur-packaging: | ||
name: Publish AUR package | ||
needs: gh-release | ||
runs-on: ubuntu-latest | ||
env: | ||
PKG_NAME: bato | ||
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 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,30 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
push: | ||
branches: | ||
- master | ||
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 libnotify | ||
run: sudo apt-get install libnotify-dev | ||
- name: Lint | ||
run: cargo clippy | ||
- name: Check | ||
run: cargo check |
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=bato | ||
pkgver=0.1.0 | ||
pkgrel=1 | ||
pkgdesc='Small program to send battery notifications' | ||
arch=('x86_64') | ||
url='https://github.com/doums/bato' | ||
license=('MPL2') | ||
depends=('libnotify') | ||
makedepends=('rust' 'cargo' 'cmake') | ||
provides=('bato') | ||
conflicts=('bato') | ||
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/bato" "$pkgdir/usr/bin/bato" | ||
install -Dvm 644 "bato.yaml" "$pkgdir/usr/share/doc/bato/config/bato.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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "bato" | ||
version = "0.1.6" | ||
version = "0.1.7" | ||
authors = ["pierre <[email protected]>"] | ||
edition = "2021" | ||
links = "notilus" | ||
|
@@ -12,3 +12,8 @@ serde_yaml = "0.9" | |
|
||
[build-dependencies] | ||
cmake = "0.1" | ||
|
||
[profile.release] | ||
strip = true | ||
opt-level = "s" | ||
lto = true |
Oops, something went wrong.