9 Commits

Author SHA1 Message Date
alice pellerin 8f38d07385 only run build.rs when environment variables are non-empty 2026-05-02 00:12:18 -05:00
alice pellerin e437cecb48 fix windows packaging 2026-05-02 00:05:56 -05:00
alice pellerin 2198c9f787 enable publishing on build success 2026-05-02 00:03:28 -05:00
alice pellerin bd67084b87 fix windows CI 2026-05-02 00:01:17 -05:00
alice pellerin ebdf1061cf fix tar.gz packaging 2026-05-01 23:57:13 -05:00
alice pellerin b755f4a603 fix completion/manpage generation 2026-05-01 23:54:47 -05:00
alice pellerin 5bdb44ffba fix CI syntax 2026-05-01 23:47:40 -05:00
alice pellerin d320e286c1 fix version number 2026-05-01 23:44:27 -05:00
alice pellerin f8f6f7e3ef fix packaging, add completions/manpage 2026-05-01 23:43:26 -05:00
5 changed files with 65 additions and 44 deletions
-21
View File
@@ -1,21 +0,0 @@
name: publish
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC token exchange
steps:
- uses: actions/checkout@v6
- name: check version
# cut off the v part of the tag to only search for the number
# include the " = " to not match on main, only v* tags
run: grep -q " = \"$(echo "${{ github.ref_name }}" | cut -c2-)\"" Cargo.toml
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
+44 -11
View File
@@ -6,46 +6,79 @@ on:
tags: tags:
- "v*" - "v*"
permissions:
contents: write
jobs: jobs:
release: release:
runs-on: ${{ matrix.info.runs-on }} runs-on: ${{ matrix.info.runs-on }}
permissions:
contents: write
strategy: strategy:
matrix: matrix:
info: info:
- os: "macOS-arm" - os: "macOS-arm"
runs-on: "macos-latest" runs-on: "macos-latest"
package-extension: "tar.gz"
executable-extension: "" executable-extension: ""
- os: "macOS-intel" - os: "macOS-intel"
runs-on: "macos-26-intel" runs-on: "macos-26-intel"
package-extension: "tar.gz"
executable-extension: "" executable-extension: ""
- os: "linux-x86_64" - os: "linux-x86_64"
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
package-extension: "tar.gz"
executable-extension: "" executable-extension: ""
- os: "linux-arm" - os: "linux-arm"
runs-on: "ubuntu-24.04-arm" runs-on: "ubuntu-24.04-arm"
package-extension: "tar.gz"
executable-extension: "" executable-extension: ""
- os: "Windows-x86_64" - os: "Windows-x86_64"
runs-on: "windows-latest" runs-on: "windows-latest"
package-extension: "zip"
executable-extension: ".exe" executable-extension: ".exe"
- os: "Windows-arm" - os: "Windows-arm"
runs-on: "windows-11-arm" runs-on: "windows-11-arm"
package-extension: "zip"
executable-extension: ".exe" executable-extension: ".exe"
steps: steps:
- uses: actions/checkout@v6 - name: checkout
uses: actions/checkout@v6
- name: check version - name: check version
# cut off the v part of the tag to only search for the number # cut off the v part of the tag to only search for the number
run: grep -q "$(echo "${{ github.ref_name }}" | cut -c2-)" Cargo.toml run: grep --quiet "$(echo "${{ github.ref_name }}" | cut -c2-)" Cargo.toml
- run: cargo test --release - name: test
- run: cargo build --release --locked run: cargo test --release
- name: package - name: make completion/manpage folders
# TODO: include completions/man page run: mkdir completions; mkdir manpage
run: tar -azcf "hexapoda-${{ matrix.info.os }}-${{ github.ref_name }}.zip" -C "target/release/" "hexapoda${{ matrix.info.executable-extension }}" - name: build
run: cargo build --release --locked
env:
HEXAPODA_COMPLETIONS: completions
HEXAPODA_MANPAGE: manpage
- name: package-tar-gz
if: ${{ matrix.info.package-extension == 'tar.gz' }}
run: tar --create --gzip --file "hexapoda-${{ matrix.info.os }}-${{ github.ref_name }}.tar.gz" "completions" "manpage" -C "target/release/" "hexapoda${{ matrix.info.executable-extension }}"
- name: package-zip
if: ${{ matrix.info.package-extension == 'zip' }}
run: tar --create --auto-compress --file "hexapoda-${{ matrix.info.os }}-${{ github.ref_name }}.zip" "completions" "manpage" -C "target/release/" "hexapoda${{ matrix.info.executable-extension }}"
- name: release - name: release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
draft: true draft: true
name: "${{ github.ref_name }}" name: "${{ github.ref_name }}"
files: hexapoda-${{ matrix.info.os }}-${{ github.ref_name }}.zip files: "hexapoda-${{ matrix.info.os }}-${{ github.ref_name }}.${{ matrix.info.package-extension }}"
publish:
runs-on: ubuntu-latest
needs: release
permissions:
id-token: write # Required for OIDC token exchange
steps:
- uses: actions/checkout@v6
- name: check version
# cut off the v part of the tag to only search for the number
# include the " = " to not match on main, only v* tags
run: grep -q " = \"$(echo "${{ github.ref_name }}" | cut -c2-)\"" Cargo.toml
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
Generated
+1 -1
View File
@@ -568,7 +568,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "hexapoda" name = "hexapoda"
version = "0.2.1" version = "0.2.2"
dependencies = [ dependencies = [
"clap", "clap",
"clap_complete", "clap_complete",
+7 -4
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "hexapoda" name = "hexapoda"
# if run manually, CI will check for the string "ain" (lol), so here you go :) # if run manually, CI will check for the string "ain" (lol), so here you go :)
version = "0.2.1" version = "0.2.2"
description = "a colorful modal hex editor" description = "a colorful modal hex editor"
repository = "https://github.com/simonomi/hexapoda" repository = "https://github.com/simonomi/hexapoda"
keywords = ["cli", "tui", "hex", "tool", "editor"] keywords = ["cli", "tui", "hex", "tool", "editor"]
@@ -24,23 +24,26 @@ clap_complete = "4.6.3"
clap_complete_nushell = "4.6.0" clap_complete_nushell = "4.6.0"
clap_mangen = "0.3.0" clap_mangen = "0.3.0"
[package.metadata.binstall]
pkg-fmt = "zip"
[package.metadata.binstall.overrides.'cfg(all(target_os = "macos", target_arch = "aarch64" ))'] [package.metadata.binstall.overrides.'cfg(all(target_os = "macos", target_arch = "aarch64" ))']
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-macOS-arm-v{ version }{ archive-suffix }" pkg-url = "{ repo }/releases/download/v{ version }/{ name }-macOS-arm-v{ version }{ archive-suffix }"
pkg-fmt = "tgz"
[package.metadata.binstall.overrides.'cfg(all(target_os = "macos", target_arch = "x86_64" ))'] [package.metadata.binstall.overrides.'cfg(all(target_os = "macos", target_arch = "x86_64" ))']
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-macOS-intel-v{ version }{ archive-suffix }" pkg-url = "{ repo }/releases/download/v{ version }/{ name }-macOS-intel-v{ version }{ archive-suffix }"
pkg-fmt = "tgz"
[package.metadata.binstall.overrides.'cfg(all(target_os = "linux", target_arch = "x86_64" ))'] [package.metadata.binstall.overrides.'cfg(all(target_os = "linux", target_arch = "x86_64" ))']
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-linux-x86_64-v{ version }{ archive-suffix }" pkg-url = "{ repo }/releases/download/v{ version }/{ name }-linux-x86_64-v{ version }{ archive-suffix }"
pkg-fmt = "tgz"
[package.metadata.binstall.overrides.'cfg(all(target_os = "linux", target_arch = "aarch64" ))'] [package.metadata.binstall.overrides.'cfg(all(target_os = "linux", target_arch = "aarch64" ))']
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-linux-arm-v{ version }{ archive-suffix }" pkg-url = "{ repo }/releases/download/v{ version }/{ name }-linux-arm-v{ version }{ archive-suffix }"
pkg-fmt = "tgz"
[package.metadata.binstall.overrides.'cfg(all(target_os = "windows", target_arch = "x86_64" ))'] [package.metadata.binstall.overrides.'cfg(all(target_os = "windows", target_arch = "x86_64" ))']
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-Windows-x86_64-v{ version }{ archive-suffix }" pkg-url = "{ repo }/releases/download/v{ version }/{ name }-Windows-x86_64-v{ version }{ archive-suffix }"
pkg-fmt = "zip"
[package.metadata.binstall.overrides.'cfg(all(target_os = "windows", target_arch = "aarch64" ))'] [package.metadata.binstall.overrides.'cfg(all(target_os = "windows", target_arch = "aarch64" ))']
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-Windows-arm-v{ version }{ archive-suffix }" pkg-url = "{ repo }/releases/download/v{ version }/{ name }-Windows-arm-v{ version }{ archive-suffix }"
pkg-fmt = "zip"
+13 -7
View File
@@ -7,20 +7,26 @@ use std::io::Error;
include!("src/arguments.rs"); include!("src/arguments.rs");
fn main() -> Result<(), Error> { fn main() -> Result<(), Error> {
let output_folder = match env::var_os("OUT_DIR") { let completions_folder = match env::var_os("HEXAPODA_COMPLETIONS") {
None => return Ok(()), Some(folder) if !folder.is_empty() => folder,
Some(output_folder) => output_folder, _ => return Ok(()),
};
let manpage_folder = match env::var_os("HEXAPODA_MANPAGE") {
Some(folder) if !folder.is_empty() => folder,
_ => return Ok(()),
}; };
let mut command = Arguments::command(); let mut command = Arguments::command();
for &shell in Shell::value_variants() { for &shell in Shell::value_variants() {
generate_to(shell, &mut command, "hexapoda", &output_folder)?; generate_to(shell, &mut command, "hexapoda", &completions_folder)?;
} }
generate_to(Nushell, &mut command, "hexapoda", &output_folder)?; generate_to(Nushell, &mut command, "hexapoda", &completions_folder)?;
clap_mangen::generate_to(command, &output_folder)?; clap_mangen::generate_to(command, &manpage_folder)?;
println!("cargo:warning=completions and manpage generated in {output_folder:?}"); println!("cargo:warning=completions generated in {completions_folder:?}");
println!("cargo:warning=manpage generated in {manpage_folder:?}");
println!("cargo:rerun-if-changed=src/arguments.rs"); println!("cargo:rerun-if-changed=src/arguments.rs");
Ok(()) Ok(())