Skip to content

Commit

Permalink
Build CLI binaries and attach them to release (#330)
Browse files Browse the repository at this point in the history
Build CLI binaries and attach them to release

Co-authored-by: Kendall Weihe <[email protected]>

---------

Co-authored-by: Kendall Weihe <[email protected]>
  • Loading branch information
finn-block and KendallWeihe authored Aug 30, 2024
1 parent 1c34f0a commit caacb9a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 10 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build web5_cli release artifacts

on:
release:
types: [created]

jobs:
build_cli_aarch64-apple-darwin:
runs-on: macos-latest
name: aarch64-apple-darwin
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup toolchain install stable
- name: cargo build
run: |
cargo build --target aarch64-apple-darwin --release --package web5_cli
cp -v target/aarch64-apple-darwin/release/web5_cli web5_cli-aarch64-apple-darwin
- name: upload release asset
uses: AButler/[email protected]
with:
files: web5_cli-aarch64-apple-darwin
repo-token: ${{ secrets.GITHUB_TOKEN }}

build_cli_x86_64_apple_darwin:
runs-on: macos-12
name: x86_64-apple-darwin
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup toolchain install stable
- name: cargo build
run: |
cargo build --target x86_64-apple-darwin --release --package web5_cli --features x86_64_apple_darwin
cp -v target/x86_64-apple-darwin/release/web5_cli web5_cli-x86_64-apple-darwin
- name: upload release asset
uses: AButler/[email protected]
with:
files: web5_cli-x86_64-apple-darwin
repo-token: ${{ secrets.GITHUB_TOKEN }}

build_cli_x86_64_unknown_linux_gnu:
runs-on: ubuntu-latest
name: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
- name: cargo build
run: |
cargo build --target x86_64-unknown-linux-gnu --release --package web5_cli
cp -v target/x86_64-unknown-linux-gnu/release/web5_cli web5_cli-x86_64-unknown-linux-gnu
- name: upload release asset
uses: AButler/[email protected]
with:
files: web5_cli-x86_64-unknown-linux-gnu
repo-token: ${{ secrets.GITHUB_TOKEN }}

build_cli_x86_64_unknown_linux_musl:
runs-on: ubuntu-latest
name: x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v2
- name: Run Build Script
run: |
pushd crates/web5_cli/build/x86_64_unknown_linux_musl
./build
popd
cp target/x86_64-unknown-linux-musl/release/web5_cli web5_cli-x86_64-unknown-linux-musl
- name: upload release asset
uses: AButler/[email protected]
with:
files: web5_cli-x86_64-unknown-linux-musl
repo-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
# The format is described: https://github.blog/2017-07-06-introducing-code-owners/

# These owners will be the default owners for everything in the repo.
* @KendallWeihe @nitro-neal @kirahsapong @shamilovtim @diehuxx @decentralgabe @frankhinek @leordev @ALRubinger
* @KendallWeihe @nitro-neal @kirahsapong @shamilovtim @diehuxx @decentralgabe @frankhinek @leordev @ALRubinger

.github/workflows/release.yaml @finn-tbd

# -----------------------------------------------
# BELOW THIS LINE ARE TEMPLATES, UNUSED
Expand All @@ -21,4 +22,4 @@
# *.js @octocat @github/js

# You can also use email addresses if you prefer.
# docs/* [email protected]
# docs/* [email protected]
17 changes: 9 additions & 8 deletions crates/web5_cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,29 @@ ARCH=$(uname -m)
case $OS in
"linux")
case $ARCH in
"x86_64") FILENAME="web5-x86_64-linux-gnu.zip" ;;
"x86_64") FILENAME="web5-x86_64-linux-gnu" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
;;
"darwin")
case $ARCH in
"x86_64") FILENAME="web5-x86_64-apple-darwin.zip" ;;
"arm64") FILENAME="web5-aarch64-apple-darwin.zip" ;;
"x86_64") FILENAME="web5-x86_64-apple-darwin" ;;
"arm64") FILENAME="web5-aarch64-apple-darwin" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
;;
*)
echo "Unsupported OS: $OS"; exit 1 ;;
esac

# Download and unzip
# Download
curl -L -o /tmp/$FILENAME https://github.com/TBD54566975/web5-rs/releases/download/$VERSION/$FILENAME
unzip -o /tmp/$FILENAME -d /tmp

# Move the executable to /usr/local/bin and make it executable
sudo mv /tmp/web5_cli /usr/local/bin/web5
sudo chmod +x /usr/local/bin/web5
# give it executable permissions
chmod +x /tmp/$FILENAME

# Move the executable to /usr/local/bin
sudo mv /tmp/$FILENAME /usr/local/bin/web5

# Cleanup
rm /tmp/$FILENAME

0 comments on commit caacb9a

Please sign in to comment.