Skip to content

Commit

Permalink
ci: release pre-built binaries for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Aug 28, 2023
1 parent 4c827d9 commit 8c967bb
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,67 @@ jobs:
files: "target/${{ matrix.target }}/release/starkli-${{ matrix.target }}.tar.gz"
generate_release_notes: true
draft: true

release-android:
name: "Build for aarch64-linux-android"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout source code"
uses: "actions/checkout@v3"
with:
fetch-depth: 0

- name: "Checkout termux-packages"
run: |
cd ..
git clone https://github.com/termux/termux-packages
cd termux-packages
git checkout f193e6f6d1f759f8233ba44bb02a3a45e637bc32
- name: "Setup local repository"
run: |
REPO=$(pwd)
cd ../termux-packages
mkdir ./starkli && cd starkli
git init --bare
cd $REPO
git remote set-url origin ../termux-packages/starkli
git tag v0.0.0
git push origin v0.0.0
- name: "Build for aarch64"
run: |
cd ../termux-packages
mkdir ./packages/starkli
cp ../starkli/build/termux.sh ./packages/starkli/build.sh
./scripts/run-docker.sh ./build-package.sh -a aarch64 starkli
- name: "Extract binary"
run: |
REPO=$(pwd)
mkdir -p target/aarch64-linux-android/release
cd ../termux-packages/output
ar x starkli_0.0.0_aarch64.deb
tar Jxvf data.tar.xz
mv ./data/data/com.termux/files/usr/bin/starkli $REPO/target/aarch64-linux-android/release
- name: "Upload artifacts"
uses: "actions/upload-artifact@v3"
with:
name: "starkli-aarch64-linux-android"
path: "target/aarch64-linux-android/release/starkli"

- name: "Tar release"
run: |
cd target/aarch64-linux-android/release/
tar zcvf ./starkli-aarch64-linux-android.tar.gz ./starkli
- name: "Publish tar"
uses: "softprops/action-gh-release@v1"
with:
files: "target/aarch64-linux-android/release/starkli-aarch64-linux-android.tar.gz"
generate_release_notes: true
draft: true
28 changes: 28 additions & 0 deletions build/termux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TERMUX_PKG_DESCRIPTION="Starkli (/ˈstɑːrklaɪ/), a blazing fast CLI tool for Starknet powered by starknet-rs"
TERMUX_PKG_LICENSE="MPL-2.0"
TERMUX_PKG_MAINTAINER="Jonathan Lei <[email protected]>"
TERMUX_PKG_VERSION="0.0.0"
TERMUX_PKG_SRCURL="git+/home/builder/termux-packages/starkli"
TERMUX_PKG_BUILD_IN_SRC=true

termux_step_make() {
termux_setup_rust
cargo build --jobs ${TERMUX_MAKE_PROCESSES} --target ${CARGO_TARGET_NAME} --release
}

termux_step_make_install() {
install -Dm700 -t ${TERMUX_PREFIX}/bin target/${CARGO_TARGET_NAME}/release/starkli

install -Dm644 /dev/null ${TERMUX_PREFIX}/share/bash-completion/completions/starkli.bash
install -Dm644 /dev/null ${TERMUX_PREFIX}/share/zsh/site-functions/_starkli
install -Dm644 /dev/null ${TERMUX_PREFIX}/share/fish/vendor_completions.d/starkli.fish
}

termux_step_create_debscripts() {
cat <<-EOF >./postinst
#!${TERMUX_PREFIX}/bin/sh
starkli setup --generate-completion bash > ${TERMUX_PREFIX}/share/bash-completion/completions/starkli.bash
starkli setup --generate-completion zsh > ${TERMUX_PREFIX}/share/zsh/site-functions/_starkli
starkli setup --generate-completion fish > ${TERMUX_PREFIX}/share/fish/vendor_completions.d/starkli.fish
EOF
}

0 comments on commit 8c967bb

Please sign in to comment.