mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
- Repo names: ziti-* → zt-* - Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt - Docker images: hanzozt/ziti-* → hanzozt/zt-* - C/Java/JS symbols: ziti_* → zt_* - File and directory names updated
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: zt-cli
|
|
description: Get zt binary and add it to the PATH
|
|
inputs:
|
|
version:
|
|
required: false
|
|
default: stable
|
|
description: |
|
|
version of zt CLI to download,
|
|
use tag (like v1.6.7) or special values:
|
|
'stable' (default) means latest release,
|
|
`latest` means most recent tagged release
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: process version
|
|
shell: bash
|
|
run: |
|
|
ver=${{ inputs.version }}
|
|
if [[ ${{ inputs.version }} == "stable" ]]; then
|
|
ver=$(gh release view --repo hanzozt/zt | awk '/^tag/{ print $2 }')
|
|
elif [[ ${{ inputs.version }} == "latest" ]]; then
|
|
ver=$(gh release list --limit 1 --repo hanzozt/zt --json "tagName" --jq ".[0].tagName")
|
|
fi
|
|
echo "using version = $ver"
|
|
echo "ZITI_VERSION=$ver" >> $GITHUB_ENV
|
|
|
|
- name: download zt CLI
|
|
shell: bash
|
|
run: |
|
|
os=${{ runner.os }}
|
|
case ${os} in
|
|
Linux) os=linux
|
|
;;
|
|
macOS) os=darwin
|
|
;;
|
|
Windows) os=windows
|
|
;;
|
|
esac
|
|
arch=$(uname -m)
|
|
if [[ "${arch}" == "x86_64" ]]; then
|
|
arch="amd64"
|
|
fi
|
|
echo "downloading zt-${os}-${arch} ${ZITI_VERSION} tarball"
|
|
mkdir -p '${{ runner.temp }}'
|
|
cd '${{ runner.temp }}'
|
|
gh release download ${ZITI_VERSION} --repo hanzozt/zt --pattern "zt-${os}-${arch}-*" --output zt.bundle
|
|
|
|
- name: extract zt CLI and add to PATH
|
|
shell: bash
|
|
run: |
|
|
cd '${{ runner.temp }}'
|
|
mkdir -p zt-cli/bin
|
|
if [[ ${{ runner.os }} == "Windows" ]]; then
|
|
mkdir -p zt-cli/bin
|
|
unzip -d 'zt-cli\bin' zt.bundle
|
|
else
|
|
tar -xpf zt.bundle -C zt-cli/bin
|
|
fi
|
|
./zt-cli/bin/zt version
|
|
echo "${{ runner.temp }}/zt-cli/bin" >> $GITHUB_PATH
|
|
|