Skip to content

Commit

Permalink
ci: build and upload cli binary
Browse files Browse the repository at this point in the history
  • Loading branch information
huancheng-trili committed Jan 20, 2025
1 parent 464ec2f commit 9fa6758
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/actions/build-cli/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build CLI binary
inputs:
platform:
description: Platform that the binary can run on, e.g. linux, macos
required: true
arch:
description: Architecture of CPU that the binary can run on, e.g. arm64, amd64
required: true
repo_token:
description: API token that gives access to manage the target repo
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- run: nix --version
shell: bash
- name: Format
shell: bash
run: nix --accept-flake-config fmt -- --fail-on-change
- name: Prevent blst
shell: bash
run: nix --accept-flake-config develop -j auto --command sh -c '[ -z "$(cargo tree | grep blst)" ]'
- name: Build
shell: bash
run: nix --accept-flake-config --log-format raw -L build -j auto .#jstz_cli
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ inputs.repo_token }}
file: result/bin/jstz
asset_name: jstz_${{ inputs.platform }}_${{ inputs.arch }}
tag: ${{ github.ref_name }}
26 changes: 26 additions & 0 deletions .github/workflows/cli-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build npm package for jstz CLI

on:
push:
tags:
- "*"

jobs:
mac:
name: Build CLI for MacOS Arm64
runs-on: macos
steps:
- uses: jstz-dev/jstz/.github/actions/build-cli@main
with:
platform: macos
arch: arm64
repo_token: ${{ secrets.GITHUB_TOKEN }}
linux-amd64:
name: Build CLI for Linux AMD64
runs-on: [x86_64, linux, nix]
steps:
- uses: jstz-dev/jstz/.github/actions/build-cli@main
with:
platform: linux
arch: amd64
repo_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9fa6758

Please sign in to comment.