Skip to content

Commit e7e10c6

Browse files
committed
Add crates.io publish workflow and package metadata
1 parent 83b3dbf commit e7e10c6

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'Cargo.toml'
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 2
16+
17+
- name: Detect version bump
18+
id: version
19+
run: |
20+
current=$(grep -m1 '^version = ' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
21+
previous=$(git show HEAD~1:Cargo.toml 2>/dev/null | grep -m1 '^version = ' | sed -E 's/version = "(.*)"/\1/' || echo "")
22+
echo "current=$current"
23+
echo "previous=$previous"
24+
echo "current=$current" >> "$GITHUB_OUTPUT"
25+
if [ -n "$current" ] && [ "$current" != "$previous" ]; then
26+
echo "changed=true" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "changed=false" >> "$GITHUB_OUTPUT"
29+
fi
30+
31+
- name: Install Rust toolchain
32+
if: steps.version.outputs.changed == 'true'
33+
uses: dtolnay/rust-toolchain@stable
34+
35+
- name: Cache cargo registry
36+
if: steps.version.outputs.changed == 'true'
37+
uses: Swatinem/rust-cache@v2
38+
39+
- name: Publish to crates.io
40+
if: steps.version.outputs.changed == 'true'
41+
env:
42+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
43+
run: cargo publish --locked
44+
45+
- name: Tag release
46+
if: steps.version.outputs.changed == 'true'
47+
env:
48+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
run: |
50+
tag="v${{ steps.version.outputs.current }}"
51+
git tag "$tag"
52+
git push origin "$tag"

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
name = "glry"
33
version = "0.1.0"
44
edition = "2024"
5+
description = "A terminal image gallery with thumbnails rendered as real pixels via Kitty, iTerm2, or Sixel."
6+
license = "MIT"
7+
repository = "https://github.com/uherman/glry"
8+
homepage = "https://github.com/uherman/glry"
9+
readme = "README.md"
10+
keywords = ["tui", "terminal", "image", "gallery", "viewer"]
11+
categories = ["command-line-utilities", "multimedia::images"]
12+
exclude = [".assets/*", ".github/*"]
513

614
[dependencies]
715
ratatui = "0.30"

0 commit comments

Comments
 (0)