Skip to content

Commit

Permalink
Deploy ahnlich-cli as independent entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamdavidonuh committed Sep 30, 2024
1 parent 1f78f00 commit 5f03854
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 46 deletions.
68 changes: 23 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
name: Build Binaries
runs-on: ubuntu-latest
outputs:
bin_name: ${{ steps.get_binary_version.outputs.BIN_NAME }}
bin_suffix: ${{ steps.get_binary_version.outputs.BIN_SUFFIX }}
bin_name: ${{ steps.get_binary_type.outputs.BIN_NAME }}
bin_suffix: ${{ steps.get_binary_type.outputs.BIN_SUFFIX }}
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Get Binary Version"
id: get_binary_version
- name: "Get Binary Type"
id: get_binary_type
run: |
cd ${{github.workspace}}
echo ${{ github.event.release.tag_name }}
Expand All @@ -40,17 +40,12 @@ jobs:
with:
version: 0.13.0

- name: Build Linux Release for ${{ steps.get_binary_version.outputs.BIN_NAME }} And CLI
- name: Build Linux Release for ${{ steps.get_binary_type.outputs.BIN_NAME }}
working-directory: ./ahnlich
run: |
cargo build --release --bin ${{ steps.get_binary_version.outputs.BIN_NAME }}
tar -cvzf linux-${{ steps.get_binary_version.outputs.BIN_NAME }}.tar.gz -C target/release ${{ steps.get_binary_version.outputs.BIN_NAME }}
cargo build --release --bin ahnlich_cli
tar -cvzf linux-ahnlich_cli.tar.gz -C target/release ahnlich_cli
gh release upload ${{github.event.release.tag_name}} linux-${{ steps.get_binary_version.outputs.BIN_NAME }}.tar.gz
gh release upload ${{github.event.release.tag_name}} linux-ahnlich_cli.tar.gz
cargo build --release --bin ${{ steps.get_binary_type.outputs.BIN_NAME }}
tar -cvzf linux-${{ steps.get_binary_type.outputs.BIN_NAME }}.tar.gz -C target/release ${{ steps.get_binary_type.outputs.BIN_NAME }}
gh release upload ${{github.event.release.tag_name}} linux-${{ steps.get_binary_type.outputs.BIN_NAME }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -61,34 +56,27 @@ jobs:
run: |
cargo install --locked cargo-zigbuild --version 0.19.1
- name: Build Aarch64 Darwin Release for ${{ steps.get_binary_version.outputs.BIN_NAME }} And CLI
- name: Build Aarch64 Darwin Release for ${{ steps.get_binary_type.outputs.BIN_NAME }}
working-directory: ./ahnlich
run: |
rustup target add aarch64-apple-darwin
cargo zigbuild --release --target aarch64-apple-darwin --bin ${{ steps.get_binary_version.outputs.BIN_NAME }}
tar -cvzf aarch64-darwin-${{ steps.get_binary_version.outputs.BIN_NAME }}.tar.gz -C target/aarch64-apple-darwin/release ${{ steps.get_binary_version.outputs.BIN_NAME }}
cargo zigbuild --release --target aarch64-apple-darwin --bin ${{ steps.get_binary_type.outputs.BIN_NAME }}
tar -cvzf aarch64-darwin-${{ steps.get_binary_type.outputs.BIN_NAME }}.tar.gz -C target/aarch64-apple-darwin/release ${{ steps.get_binary_type.outputs.BIN_NAME }}
gh release upload ${{github.event.release.tag_name}} aarch64-darwin-${{ steps.get_binary_type.outputs.BIN_NAME }}.tar.gz
cargo zigbuild --release --target aarch64-apple-darwin --bin ahnlich_cli
tar -cvzf aarch64-darwin-ahnlich_cli.tar.gz -C target/aarch64-apple-darwin/release ahnlich_cli
gh release upload ${{github.event.release.tag_name}} aarch64-darwin-${{ steps.get_binary_version.outputs.BIN_NAME }}.tar.gz
gh release upload ${{github.event.release.tag_name}} aarch64-darwin-ahnlich_cli.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
shell: bash

- name: Build x86_64 Apple Darwin Release for ${{ steps.get_binary_version.outputs.BIN_NAME }} And CLI
- name: Build x86_64 Apple Darwin Release for ${{ steps.get_binary_type.outputs.BIN_NAME }}
working-directory: ./ahnlich
run: |
rustup target add x86_64-apple-darwin
cargo zigbuild --release --target x86_64-apple-darwin --bin ${{ steps.get_binary_version.outputs.BIN_NAME }}
tar -cvzf x86_64-apple-darwin-${{ steps.get_binary_version.outputs.BIN_NAME }}.tar.gz -C target/x86_64-apple-darwin/release ${{ steps.get_binary_version.outputs.BIN_NAME }}
cargo zigbuild --release --target x86_64-apple-darwin --bin ahnlich_cli
tar -cvzf x86_64-apple-darwin-ahnlich_cli.tar.gz -C target/x86_64-apple-darwin/release ahnlich_cli
cargo zigbuild --release --target x86_64-apple-darwin --bin ${{ steps.get_binary_type.outputs.BIN_NAME }}
tar -cvzf x86_64-apple-darwin-${{ steps.get_binary_type.outputs.BIN_NAME }}.tar.gz -C target/x86_64-apple-darwin/release ${{ steps.get_binary_type.outputs.BIN_NAME }}
gh release upload ${{github.event.release.tag_name}} x86_64-apple-darwin-${{ steps.get_binary_type.outputs.BIN_NAME }}.tar.gz
gh release upload ${{github.event.release.tag_name}} x86_64-apple-darwin-${{ steps.get_binary_version.outputs.BIN_NAME }}.tar.gz
gh release upload ${{github.event.release.tag_name}} x86_64-apple-darwin-ahnlich_cli.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
shell: bash
Expand All @@ -98,32 +86,21 @@ jobs:
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build Windows x86_64-pc-windows-gnu for Ahnlich ${{ steps.get_binary_version.outputs.BIN_NAME }}
uses: houseabsolute/actions-rust-cross@v0
with:
working-directory: ./ahnlich
command: build
target: x86_64-pc-windows-gnu
args: "--locked --release --bin ${{ steps.get_binary_version.outputs.BIN_NAME }}"
strip: true

- name: Build Windows x86_64-pc-windows-gnu for Ahnlich CLI
- name: Build Windows x86_64-pc-windows-gnu for Ahnlich ${{ steps.get_binary_type.outputs.BIN_NAME }}
uses: houseabsolute/actions-rust-cross@v0
with:
working-directory: ./ahnlich
command: build
target: x86_64-pc-windows-gnu
args: "--locked --release --bin ahnlich_cli"
args: "--locked --release --bin ${{ steps.get_binary_type.outputs.BIN_NAME }}"
strip: true

- name: Package and upload x86_64-pc-windows-gnu for Ahnlich ${{ steps.get_binary_version.outputs.BIN_NAME }} and CLI
- name: Package and upload x86_64-pc-windows-gnu for Ahnlich ${{ steps.get_binary_type.outputs.BIN_NAME }}
working-directory: ./ahnlich
run: |
cd target/x86_64-pc-windows-gnu/release/ && zip ../../../win-x86_64-gnu-${{ steps.get_binary_version.outputs.BIN_NAME }}.zip ${{ steps.get_binary_version.outputs.BIN_NAME }}.exe && cd ../../../
cd target/x86_64-pc-windows-gnu/release/ && zip ../../../win-x86_64-gnu-ahnlich_cli.zip ahnlich_cli.exe && cd ../../../
cd target/x86_64-pc-windows-gnu/release/ && zip ../../../win-x86_64-gnu-${{ steps.get_binary_type.outputs.BIN_NAME }}.zip ${{ steps.get_binary_type.outputs.BIN_NAME }}.exe && cd ../../../
gh release upload ${{github.event.release.tag_name}} win-x86_64-gnu-${{ steps.get_binary_type.outputs.BIN_NAME }}.zip
gh release upload ${{github.event.release.tag_name}} win-x86_64-gnu-${{ steps.get_binary_version.outputs.BIN_NAME }}.zip
gh release upload ${{github.event.release.tag_name}} win-x86_64-gnu-ahnlich_cli.zip
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
shell: bash
Expand All @@ -132,6 +109,7 @@ jobs:
needs: build_binaries_and_publish
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
if: ${{needs.build_binaries_and_publish.outputs.bin_name != 'ahnlich-cli'}}
permissions:
packages: write
contents: read
Expand Down
2 changes: 1 addition & 1 deletion ahnlich/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[[bin]]
name = "ahnlich_cli"
name = "ahnlich-cli"
path = "src/main.rs"

[lib]
Expand Down

0 comments on commit 5f03854

Please sign in to comment.