Compare commits
No commits in common. "main" and "v0.1.1" have entirely different histories.
5 changed files with 72 additions and 91 deletions
|
|
@ -1,53 +0,0 @@
|
||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ["v*"]
|
|
||||||
|
|
||||||
env:
|
|
||||||
DL_DIR: /srv/breadway-dl
|
|
||||||
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci
|
|
||||||
PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: hestia
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: /tmp/breadpaper-build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: checkout
|
|
||||||
working-directory: /tmp
|
|
||||||
run: |
|
|
||||||
rm -rf /tmp/breadpaper-build
|
|
||||||
git clone --branch "${GITHUB_REF_NAME}" --depth 1 \
|
|
||||||
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /tmp/breadpaper-build
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
run: /home/breadway/.cargo/bin/cargo build --release --locked
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
run: /home/breadway/.cargo/bin/cargo test --release --locked
|
|
||||||
|
|
||||||
- name: prepare artifacts
|
|
||||||
run: |
|
|
||||||
VERSION="${GITHUB_REF_NAME#v}"
|
|
||||||
PKG_DIR="${DL_DIR}/breadpaper/${VERSION}"
|
|
||||||
mkdir -p "${PKG_DIR}"
|
|
||||||
cp target/release/breadpaper "${PKG_DIR}/breadpaper-x86_64"
|
|
||||||
strip "${PKG_DIR}/breadpaper-x86_64"
|
|
||||||
sha256sum "${PKG_DIR}/breadpaper-x86_64" | awk '{print $1}' \
|
|
||||||
> "${PKG_DIR}/breadpaper-x86_64.sha256"
|
|
||||||
cp bakery.toml "${PKG_DIR}/bakery.toml"
|
|
||||||
ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest"
|
|
||||||
|
|
||||||
- name: ensure bread-ecosystem
|
|
||||||
working-directory: /tmp
|
|
||||||
run: |
|
|
||||||
rm -rf "${ECOSYSTEM_DIR}"
|
|
||||||
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
|
|
||||||
|
|
||||||
- name: regenerate index.json
|
|
||||||
working-directory: /tmp
|
|
||||||
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"
|
|
||||||
61
.github/workflows/release.yml
vendored
Normal file
61
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
DL_DIR: /srv/breadway-dl
|
||||||
|
ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [self-hosted, hestia]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: cargo build --release --locked
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cargo test --release --locked
|
||||||
|
|
||||||
|
- name: prepare artifacts
|
||||||
|
run: |
|
||||||
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
|
PKG_DIR="${DL_DIR}/breadpaper/${VERSION}"
|
||||||
|
mkdir -p "${PKG_DIR}"
|
||||||
|
cp target/release/breadpaper "${PKG_DIR}/breadpaper-x86_64"
|
||||||
|
strip "${PKG_DIR}/breadpaper-x86_64"
|
||||||
|
sha256sum "${PKG_DIR}/breadpaper-x86_64" | awk '{print $1}' \
|
||||||
|
> "${PKG_DIR}/breadpaper-x86_64.sha256"
|
||||||
|
cp bakery.toml "${PKG_DIR}/bakery.toml"
|
||||||
|
ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest"
|
||||||
|
|
||||||
|
- name: ensure bread-ecosystem
|
||||||
|
run: |
|
||||||
|
if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then
|
||||||
|
git -C "${ECOSYSTEM_DIR}" pull --ff-only
|
||||||
|
else
|
||||||
|
mkdir -p "$(dirname "${ECOSYSTEM_DIR}")"
|
||||||
|
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: regenerate index.json
|
||||||
|
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"
|
||||||
|
|
||||||
|
- name: upload to GitHub Release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
VERSION="${GITHUB_REF_NAME#v}"
|
||||||
|
PKG_DIR="${DL_DIR}/breadpaper/${VERSION}"
|
||||||
|
gh release create "${GITHUB_REF_NAME}" \
|
||||||
|
--title "breadpaper v${VERSION}" --generate-notes 2>/dev/null || true
|
||||||
|
gh release upload "${GITHUB_REF_NAME}" \
|
||||||
|
"${PKG_DIR}/breadpaper-x86_64" \
|
||||||
|
"${PKG_DIR}/breadpaper-x86_64.sha256" \
|
||||||
|
--clobber
|
||||||
21
LICENSE
21
LICENSE
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2026 Breadway
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
24
src/main.rs
24
src/main.rs
|
|
@ -4,23 +4,19 @@ use std::process;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(
|
#[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")]
|
||||||
name = "breadpaper",
|
|
||||||
version,
|
|
||||||
about = "Wallpaper manager for the bread desktop"
|
|
||||||
)]
|
|
||||||
struct Cli {
|
struct Cli {
|
||||||
/// Image file to set as wallpaper (shorthand for `set`)
|
|
||||||
path: Option<PathBuf>,
|
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Option<Command>,
|
command: Command,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
enum Command {
|
enum Command {
|
||||||
/// Set wallpaper, generate pywal palette, and reload bread themes
|
/// Set wallpaper, generate pywal palette, and reload bread themes
|
||||||
Set { path: PathBuf },
|
Set {
|
||||||
|
/// Path to the image file
|
||||||
|
path: PathBuf,
|
||||||
|
},
|
||||||
/// Print the current wallpaper path
|
/// Print the current wallpaper path
|
||||||
Get,
|
Get,
|
||||||
}
|
}
|
||||||
|
|
@ -28,11 +24,9 @@ enum Command {
|
||||||
fn main() {
|
fn main() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
let result = match (cli.command, cli.path) {
|
let result = match cli.command {
|
||||||
(Some(Command::Set { path }), _) | (None, Some(path)) => breadpaper::set(&path),
|
Command::Set { path } => breadpaper::set(&path),
|
||||||
(Some(Command::Get), _) | (None, None) => {
|
Command::Get => breadpaper::get().map(|p| println!("{}", p.display())),
|
||||||
breadpaper::get().map(|p| println!("{}", p.display()))
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ use anyhow::{Context, Result, bail};
|
||||||
|
|
||||||
pub fn apply(path: &Path) -> Result<()> {
|
pub fn apply(path: &Path) -> Result<()> {
|
||||||
let status = Command::new("awww")
|
let status = Command::new("awww")
|
||||||
.arg("img")
|
.arg("set")
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.status()
|
.status()
|
||||||
.context("failed to run awww — is awww-daemon running?")?;
|
.context("failed to run awww — is awww-daemon running?")?;
|
||||||
|
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
bail!("awww img exited with {}", status);
|
bail!("awww set exited with {}", status);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue