mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
feat: add 'scripts/install.sh' to make the installation more easy (#443)
This commit is contained in:
41
.github/workflows/release.yml
vendored
41
.github/workflows/release.yml
vendored
@@ -2,6 +2,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
@@ -13,20 +14,20 @@ jobs:
|
|||||||
name: Build binary
|
name: Build binary
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# The file format is greptime-<tag>.<os>-<arch>
|
# The file format is greptime-<os>-<arch>
|
||||||
include:
|
include:
|
||||||
- arch: x86_64-unknown-linux-gnu
|
- arch: x86_64-unknown-linux-gnu
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
file: greptime-${{ github.ref_name }}.linux-amd64
|
file: greptime-linux-amd64
|
||||||
- arch: aarch64-unknown-linux-gnu
|
- arch: aarch64-unknown-linux-gnu
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
file: greptime-${{ github.ref_name }}.linux-arm64
|
file: greptime-linux-arm64
|
||||||
- arch: aarch64-apple-darwin
|
- arch: aarch64-apple-darwin
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
file: greptime-${{ github.ref_name }}.darwin-arm64
|
file: greptime-darwin-arm64
|
||||||
- arch: x86_64-apple-darwin
|
- arch: x86_64-apple-darwin
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
file: greptime-${{ github.ref_name }}.darwin-amd64
|
file: greptime-darwin-amd64
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
@@ -84,14 +85,15 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd target/${{ matrix.arch }}/release
|
cd target/${{ matrix.arch }}/release
|
||||||
cp greptime ${{ matrix.file }}
|
chmod +x greptime
|
||||||
echo $(shasum -a 256 greptime | cut -f1 -d' ') > ${{ matrix.file }}.sha256sum
|
tar -zcvf ${{ matrix.file }}.tgz greptime
|
||||||
|
echo $(shasum -a 256 ${{ matrix.file }}.tgz | cut -f1 -d' ') > ${{ matrix.file }}.sha256sum
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.file }}
|
name: ${{ matrix.file }}
|
||||||
path: target/${{ matrix.arch }}/release/${{ matrix.file }}
|
path: target/${{ matrix.arch }}/release/${{ matrix.file }}.tgz
|
||||||
|
|
||||||
- name: Upload checksum of artifacts
|
- name: Upload checksum of artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -114,7 +116,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: "Release ${{ github.ref_name }}"
|
name: "Release ${{ github.ref_name }}"
|
||||||
files: |
|
files: |
|
||||||
**/greptime-${{ github.ref_name }}.*
|
**/greptime-*
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
name: Build docker image
|
name: Build docker image
|
||||||
@@ -127,27 +129,26 @@ jobs:
|
|||||||
- name: Download amd64 binary
|
- name: Download amd64 binary
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: greptime-${{ github.ref_name }}.linux-amd64
|
name: greptime-linux-amd64
|
||||||
path: amd64
|
path: amd64
|
||||||
|
|
||||||
- name: Rename amd64 binary
|
- name: Unzip the amd64 artifacts
|
||||||
run: |
|
run: |
|
||||||
mv amd64/greptime-${{ github.ref_name }}.linux-amd64 amd64/greptime
|
cd amd64
|
||||||
|
tar xvf greptime-linux-amd64.tgz
|
||||||
|
rm greptime-linux-amd64.tgz
|
||||||
|
|
||||||
- name: Download arm64 binary
|
- name: Download arm64 binary
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: greptime-${{ github.ref_name }}.linux-arm64
|
name: greptime-linux-arm64
|
||||||
path: arm64
|
path: arm64
|
||||||
|
|
||||||
- name: Rename arm64 binary
|
- name: Unzip the arm64 artifacts
|
||||||
run: |
|
run: |
|
||||||
mv arm64/greptime-${{ github.ref_name }}.linux-arm64 arm64/greptime
|
cd arm64
|
||||||
|
tar xvf greptime-linux-arm64.tgz
|
||||||
- name: Set file permissions
|
rm greptime-linux-arm64.tgz
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
chmod +x amd64/greptime arm64/greptime
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
|||||||
63
scripts/install.sh
Executable file
63
scripts/install.sh
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ue
|
||||||
|
|
||||||
|
OS_TYPE=
|
||||||
|
ARCH_TYPE=
|
||||||
|
VERSION=${1:-latest}
|
||||||
|
GITHUB_ORG=GreptimeTeam
|
||||||
|
GITHUB_REPO=greptimedb
|
||||||
|
BIN=greptimedb
|
||||||
|
|
||||||
|
get_os_type() {
|
||||||
|
os_type="$(uname -s)"
|
||||||
|
|
||||||
|
case "$os_type" in
|
||||||
|
Darwin)
|
||||||
|
OS_TYPE=darwin
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
OS_TYPE=linux
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: Unknown OS type: $os_type"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
get_arch_type() {
|
||||||
|
arch_type="$(uname -m)"
|
||||||
|
|
||||||
|
case "$arch_type" in
|
||||||
|
arm64)
|
||||||
|
ARCH_TYPE=arm64
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
ARCH_TYPE=arm64
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
ARCH_TYPE=amd64
|
||||||
|
;;
|
||||||
|
amd64)
|
||||||
|
ARCH_TYPE=amd64
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: Unknown CPU type: $arch_type"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
get_os_type
|
||||||
|
get_arch_type
|
||||||
|
|
||||||
|
if [ -n "${OS_TYPE}" ] && [ -n "${ARCH_TYPE}" ]; then
|
||||||
|
echo "Downloading ${BIN}, OS: ${OS_TYPE}, Arch: ${ARCH_TYPE}, Version: ${VERSION}"
|
||||||
|
|
||||||
|
if [ "${VERSION}" = "latest" ]; then
|
||||||
|
wget "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/latest/download/${BIN}-${OS_TYPE}-${ARCH_TYPE}.tgz"
|
||||||
|
else
|
||||||
|
wget "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${VERSION}/${BIN}-${OS_TYPE}-${ARCH_TYPE}.tgz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar xvf ${BIN}-${OS_TYPE}-${ARCH_TYPE}.tgz && rm ${BIN}-${OS_TYPE}-${ARCH_TYPE}.tgz && echo "Run '${BIN} --help' to get started"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user