Skip to content

Commit 71a8ae6

Browse files
committed
ci: add .deb and .rpm builds
1 parent 9d65ef5 commit 71a8ae6

File tree

5 files changed

+161
-68
lines changed

5 files changed

+161
-68
lines changed

.github/workflows/cd.yaml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Build and upload release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
env:
11+
CARGO_INCREMENTAL: 0
12+
CARGO_NET_GIT_FETCH_WITH_CLI: true
13+
CARGO_NET_RETRY: 10
14+
CARGO_TERM_COLOR: always
15+
CARGO_PROFILE_RELEASE_LTO: true
16+
RUST_BACKTRACE: 1
17+
RUSTFLAGS: -D warnings
18+
RUSTUP_MAX_RETRIES: 10
19+
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
upload-assets:
26+
name: ${{ matrix.target }}
27+
runs-on: ${{ matrix.os }}
28+
timeout-minutes: 60
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- target: aarch64-unknown-linux-gnu
34+
os: ubuntu-22.04-arm
35+
- target: x86_64-unknown-linux-gnu
36+
os: ubuntu-22.04
37+
38+
- target: aarch64-apple-darwin
39+
os: macos-13
40+
- target: x86_64-apple-darwin
41+
os: macos-13
42+
43+
- target: aarch64-pc-windows-msvc
44+
os: windows-2022
45+
- target: x86_64-pc-windows-msvc
46+
os: windows-2022
47+
steps:
48+
- name: Install Linux system dependencies
49+
if: startsWith(matrix.os, 'ubuntu')
50+
run: sudo apt-get install libxcb1-dev libdbus-1-dev
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
- name: Install Rust toolchain
54+
uses: dtolnay/rust-toolchain@stable
55+
- uses: taiki-e/setup-cross-toolchain-action@v1
56+
with:
57+
target: ${{ matrix.target }}
58+
if: startsWith(matrix.os, 'ubuntu')
59+
- run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
60+
if: endsWith(matrix.target, 'windows-msvc')
61+
- uses: taiki-e/upload-rust-binary-action@v1
62+
with:
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
bin: tattoy
65+
target: ${{ matrix.target }}
66+
locked: true
67+
tar: unix
68+
zip: windows
69+
checksum: sha256
70+
71+
publish-deb:
72+
name: Publish Debian package
73+
runs-on: ubuntu-22.04
74+
steps:
75+
- name: Install Linux system dependencies
76+
run: sudo apt-get install libxcb1-dev libdbus-1-dev
77+
- name: Checkout
78+
uses: actions/checkout@v4
79+
- name: Install Rust toolchain
80+
uses: dtolnay/rust-toolchain@stable
81+
with:
82+
targets: x86_64-unknown-linux-gnu
83+
- name: Install `cargo-deb`
84+
uses: taiki-e/install-action@v2
85+
with:
86+
tool: cargo-deb
87+
- name: Build Debian package
88+
run: |
89+
cargo build --release --locked --package tattoy
90+
cargo-deb \
91+
--deb-revision="" \
92+
--strip \
93+
--package tattoy \
94+
--verbose \
95+
--output tattoy${{ github.ref_name }}.deb
96+
- name: Upload .deb to the release
97+
uses: svenstaro/upload-release-action@v2
98+
with:
99+
repo_token: ${{ secrets.GITHUB_TOKEN }}
100+
file: tattoy${{ github.ref_name }}.deb
101+
tag: ${{ github.ref_name }}
102+
103+
publish-rpm:
104+
name: Publish RPM package
105+
runs-on: ubuntu-22.04
106+
steps:
107+
- name: Install Linux system dependencies
108+
run: sudo apt-get install libxcb1-dev libdbus-1-dev
109+
- name: Checkout
110+
uses: actions/checkout@v4
111+
- name: Install Rust toolchain
112+
uses: dtolnay/rust-toolchain@stable
113+
with:
114+
targets: x86_64-unknown-linux-gnu
115+
- name: Install `cargo-deb`
116+
uses: taiki-e/install-action@v2
117+
with:
118+
tool: cargo-generate-rpm
119+
- name: Build RPM package
120+
run: |
121+
cargo build --release --locked --package tattoy
122+
cargo generate-rpm \
123+
--package crates/tattoy \
124+
--output tattoy-${{ github.ref_name }}.x86_64.rpm
125+
- name: Upload the release
126+
uses: svenstaro/upload-release-action@v2
127+
with:
128+
repo_token: ${{ secrets.GITHUB_TOKEN }}
129+
file: tattoy-${{ github.ref_name }}.x86_64.rpm
130+
tag: ${{ github.ref }}

.github/workflows/cross-compile.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ members = [
1010
"crates/tattoy-plugins/smokey_cursor",
1111
]
1212

13+
[profile.release]
14+
strip = "symbols"
15+
1316
[workspace.dependencies]
1417
color-eyre = "0.6.3"
1518
palette = "0.7.6"
File renamed without changes.

crates/tattoy/Cargo.toml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ description = "Eye-candy for your terminal"
44
version = "0.1.0"
55
edition = "2021"
66
readme = "README.md"
7-
repository = "TODO"
7+
repository = "https://github.com/tombh/tattoy"
88
license = "MIT"
9+
authors = ["Tom Buckley-Houston <[email protected]>"]
910
keywords = ["shell"]
1011
categories = ["shell"]
1112
default-run = "tattoy"
@@ -37,3 +38,29 @@ palette.workspace = true
3738

3839
[lints]
3940
workspace = true
41+
42+
[package.metadata.generate-rpm]
43+
assets = [
44+
{ source = "target/release/tattoy", dest = "/usr/bin/tattoy", mode = "755" },
45+
{ source = "../../LICENSE-MIT", dest = "/usr/share/doc/tattoy/LICENSE-MIT", mode = "644" },
46+
{ source = "../../README.md", dest = "/usr/share/doc/tattoy/README.md", mode = "644" }
47+
]
48+
49+
[package.metadata.deb]
50+
assets = [
51+
[
52+
"target/release/tattoy",
53+
"usr/bin/",
54+
"755",
55+
],
56+
[
57+
"../../LICENSE-MIT",
58+
"/usr/share/doc/tattoy/LICENSE-MIT",
59+
"644",
60+
],
61+
[
62+
"../../README.md",
63+
"usr/share/doc/tattoy/README",
64+
"644",
65+
]
66+
]

0 commit comments

Comments
 (0)