Skip to content

Commit

Permalink
ci: test upload
Browse files Browse the repository at this point in the history
  • Loading branch information
huancheng-trili committed Jan 15, 2025
1 parent 1cbb5d1 commit acd5922
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 28 deletions.
28 changes: 28 additions & 0 deletions .github/actions/build-cli/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name:
Build CLI binary
inputs:
kind:
description: Type of platform and architecture that the binary can run on
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: Set outputs
id: set_tag
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- run: nix --version
- name: Format
run: nix --accept-flake-config fmt -- --fail-on-change
- name: Prevent blst
run: nix --accept-flake-config develop -j auto --command sh -c '[ -z "$(cargo tree | grep blst)" ]'
- name: Build
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_name: huancheng-trili/test-cli
repo_token: ${{ secrets.TEST_RELEASE }}
file: result/bin/jstz
asset_name: jstz_${{ inputs.kind }}
tag: ${{ steps.set_tag.outputs.sha_short }}
49 changes: 21 additions & 28 deletions .github/workflows/cli-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,27 @@ on:
pull_request:

jobs:
build-cli:
name: Build CLI
runs-on: [macos]
build-cli-mac:
name: Build CLI for MacOS Arm64
runs-on: macos
steps:
- uses: actions/checkout@v4
- name: Set outputs
id: set_tag
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- run: nix --version
- name: Format
run: nix --accept-flake-config fmt -- --fail-on-change
- name: Prevent blst
run: nix --accept-flake-config develop -j auto --command sh -c '[ -z "$(cargo tree | grep blst)" ]'
- name: Build
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
- uses: jstz-dev/jstz/.github/actions/build-cli@huanchengchang-jstz-275
with:
repo_name: huancheng-trili/test-cli
repo_token: ${{ secrets.TEST_RELEASE }}
file: result/bin/jstz
asset_name: jstz
tag: ${{ steps.set_tag.outputs.sha_short }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
kind: macos_arm64
build-cli-linux:
name: Build CLI for Linux AMD64
runs-on: test
steps:
- uses: jstz-dev/jstz/.github/actions/build-cli@huanchengchang-jstz-275
with:
repo_name: huancheng-trili/test-cli
repo_token: ${{ secrets.TEST_RELEASE }}
file: result/bin/jstz
asset_name: jstz_clone
tag: ${{ steps.set_tag.outputs.sha_short }}
kind: linux_amd64
last:
needs: [build-cli-mac, build-cli-linux]
runs-on: ubuntu-latest
steps:
- name: Final
env:
link_macos: ${{needs.build-cli-mac.outputs.browser_download_url}}
link_linux: ${{needs.build-cli-linux.outputs.browser_download_url}}
run: |
echo "Links: $link_macos $link_linux"

0 comments on commit acd5922

Please sign in to comment.