Skip to content

Commit

Permalink
chore(ci): add github release for CLI (#1547)
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCiesla authored Feb 17, 2025
1 parent bdac9c8 commit 7a9bbde
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/publish_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,18 @@ jobs:
cargo login "${{ secrets.CARGO_REGISTRY_TOKEN }}"
cargo publish -p iggy-cli
github_release:
uses: ./.github/workflows/release_cli.yml
needs: tag
if: ${{ needs.tag.outputs.tag_created == 'true' }}
with:
tag_name: "iggy-cli-${{ needs.tag.outputs.iggy_cli_version }}"

finalize_cli:
runs-on: ubuntu-latest
needs:
- publish
- github_release
if: always()
steps:
- uses: actions/checkout@v4
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/release_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: release_cli

on:
workflow_call:
inputs:
tag_name:
description: 'The name of the tag to be released'
required: true
type: string

env:
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
IGGY_CI_BUILD: true

jobs:
release_cli:
name: Build and release iggy-cli binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools

- name: Build iggy-cli release binary for x86_64-unknown-linux-musl
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: x86_64-unknown-linux-musl
toolchain: stable
args: "--verbose --release --no-default-features --bin iggy"

- name: Prepare iggy-cli x86_64-unknown-linux-musl artifacts
run: |
tar cvfz iggy-cli-x86_64-unknown-linux-musl.tgz -C target/x86_64-unknown-linux-musl/release/ iggy
- name: Create Changelog
uses: orhun/git-cliff-action@v4
id: changelog
with:
config: cliff.toml
args: -vv --latest
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.content }}
files: |
iggy-cli-x86_64-unknown-linux-musl.tgz
CHANGELOG.md
tag_name: ${{ inputs.tag_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

finalize_release:
name: Finalize release
runs-on: ubuntu-latest
needs:
- release_cli
if: always()
steps:
- name: Everything is fine
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0

- name: Some checks failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1

0 comments on commit 7a9bbde

Please sign in to comment.