Skip to content

Commit c6bede5

Browse files
authored
Merge pull request #34 from acikgozb/feat/cicd
feat(cicd): Add the release pipeline for `bt`
2 parents 9ae3fe5 + 7f74643 commit c6bede5

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "bt - CI"
2+
run-name: bt- CI on ${{ github.ref }} @${{ github.actor }}
3+
4+
on:
5+
pull_request:
6+
workflow_call:
7+
8+
jobs:
9+
integrity_checks:
10+
runs-on: ubuntu-24.04
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Run clippy
17+
run: |
18+
./exec lint
19+
shell: bash
20+
21+
- name: Run all tests
22+
run: |
23+
./exec test
24+
shell: bash
25+
env:
26+
RUST_BACKTRACE: 1

.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: "bt - Release"
2+
run-name: "bt - Release on ${{ github.ref }}"
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
9+
permissions:
10+
contents: write
11+
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
GIT_TAG: ${{ github.ref_name }}
15+
16+
jobs:
17+
integrity_checks:
18+
uses: ./.github/workflows/ci.yml
19+
20+
create_release:
21+
runs-on: ubuntu-24.04
22+
needs: integrity_checks
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Create release
28+
run: |
29+
gh release create "$GIT_TAG" --verify-tag --draft --title "$GIT_TAG"
30+
31+
shell: bash
32+
33+
34+
archive:
35+
runs-on: ubuntu-24.04
36+
needs: create_release
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Create release binary
42+
env:
43+
RUST_TARGET: "x86_64-unknown-linux-gnu"
44+
run: |
45+
./exec build "$RUST_TARGET"
46+
47+
shell: bash
48+
49+
- name: Archive release binary
50+
id: create-archive
51+
env:
52+
RUST_TARGET: "x86_64-unknown-linux-gnu"
53+
run: |
54+
name="bt-$RUST_TARGET-$GIT_TAG.tar.gz"
55+
path="./target/$RUST_TARGET/release/$name"
56+
57+
./exec create_archive "$RUST_TARGET" "$path"
58+
echo "path=$path" >> "$GITHUB_OUTPUT"
59+
60+
- name: Create checksum
61+
id: create-checksum
62+
env:
63+
RUST_TARGET: "x86_64-unknown-linux-gnu"
64+
run: |
65+
name="bt-$RUST_TARGET-$GIT_TAG.sha256sum"
66+
path="./target/$RUST_TARGET/release/$name"
67+
68+
./exec create_checksum "$RUST_TARGET" "$path"
69+
echo "path=$path" >> "$GITHUB_OUTPUT"
70+
71+
- name: Upload artifacts to the release
72+
env:
73+
ARCHIVE_PATH: ${{ steps.create-archive.outputs.path }}
74+
CHECKSUM_PATH: ${{ steps.create-checksum.outputs.path }}
75+
run: |
76+
gh release upload "$GIT_TAG" \
77+
"$ARCHIVE_PATH" \
78+
"$CHECKSUM_PATH"
79+
80+
shell: bash
81+
82+
- name: Rollback release on failure
83+
if: failure()
84+
run: |
85+
gh release delete "$GIT_TAG" -y --cleanup-tag

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
[package]
22
name = "bt"
33
version = "0.1.0"
4+
authors = ["Berk Acikgoz <acikgozb@proton.me>"]
45
edition = "2024"
6+
description = "A CLI for managing bluetooth devices through Bluez D-Bus."
7+
repository = "https://github.com/acikgozb/bt"
58

69
[dependencies]
710
clap = { version = "4.5.39", features = ["derive"] }
811
tabled = { version = "0.19.0", features = ["std", "ansi"] }
912
zbus = { version = "5.7.1", default-features = false, features = ["tokio", "blocking-api"] }
13+
14+
[profile.release]
15+
lto = true
16+
strip = true
17+
codegen-units = 1

0 commit comments

Comments
 (0)