forked from Eeveid/lightOps
Compare commits
4 Commits
8db385cca6
...
9ffe425d6e
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ffe425d6e | |||
| 7e8d4baac6 | |||
| a79ef99500 | |||
| f1491ba114 |
@@ -48,40 +48,27 @@ jobs:
|
|||||||
set -eux
|
set -eux
|
||||||
if command -v apt-get >/dev/null 2>&1; then
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y build-essential pkg-config sqlite3 curl tar ca-certificates nodejs npm rustc cargo
|
apt-get install -y build-essential pkg-config sqlite3 curl tar ca-certificates nodejs npm
|
||||||
elif command -v dnf >/dev/null 2>&1; then
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
dnf install -y gcc gcc-c++ make pkgconf-pkg-config sqlite curl tar ca-certificates nodejs npm rust cargo
|
dnf install -y gcc gcc-c++ make pkgconf-pkg-config sqlite curl tar ca-certificates nodejs npm
|
||||||
elif command -v yum >/dev/null 2>&1; then
|
elif command -v yum >/dev/null 2>&1; then
|
||||||
yum install -y gcc gcc-c++ make pkgconfig sqlite curl tar ca-certificates nodejs npm rust cargo
|
yum install -y gcc gcc-c++ make pkgconfig sqlite curl tar ca-certificates nodejs npm
|
||||||
elif command -v pacman >/dev/null 2>&1; then
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
pacman -Sy --noconfirm base-devel pkgconf sqlite curl tar ca-certificates nodejs npm rust cargo
|
pacman -Sy --noconfirm base-devel pkgconf sqlite curl tar ca-certificates nodejs npm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: 安装 Rust
|
- name: 安装 Rust
|
||||||
|
env:
|
||||||
|
RUSTUP_DIST_SERVER: https://rsproxy.cn
|
||||||
|
RUSTUP_UPDATE_ROOT: https://rsproxy.cn/rustup
|
||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
PATH_BASE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
if ! command -v rustup >/dev/null 2>&1; then
|
||||||
PATH_EXTRA=""
|
|
||||||
OLD_IFS="$IFS"
|
|
||||||
IFS=':'
|
|
||||||
set -- $PATH
|
|
||||||
IFS="$OLD_IFS"
|
|
||||||
for entry in "$@"; do
|
|
||||||
[ -n "$entry" ] || continue
|
|
||||||
[ "$entry" = "$HOME/.cargo/bin" ] && continue
|
|
||||||
case ":$PATH_BASE:$PATH_EXTRA:" in
|
|
||||||
*":$entry:"*) continue ;;
|
|
||||||
esac
|
|
||||||
PATH_EXTRA="${PATH_EXTRA:+$PATH_EXTRA:}$entry"
|
|
||||||
done
|
|
||||||
export PATH="$PATH_BASE${PATH_EXTRA:+:$PATH_EXTRA}"
|
|
||||||
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
|
|
||||||
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
|
||||||
fi
|
|
||||||
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
|
|
||||||
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
|
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||||
. "$HOME/.cargo/env"
|
|
||||||
fi
|
fi
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
rustup toolchain install stable --profile minimal --no-self-update
|
||||||
|
rustup default stable
|
||||||
HOST_TARGET="$(rustc -vV | sed -n 's/^host: //p')"
|
HOST_TARGET="$(rustc -vV | sed -n 's/^host: //p')"
|
||||||
BUILD_TARGET="$HOST_TARGET"
|
BUILD_TARGET="$HOST_TARGET"
|
||||||
if [ "$HOST_TARGET" != "x86_64-unknown-linux-gnu" ] && command -v rustup >/dev/null 2>&1; then
|
if [ "$HOST_TARGET" != "x86_64-unknown-linux-gnu" ] && command -v rustup >/dev/null 2>&1; then
|
||||||
@@ -93,28 +80,22 @@ jobs:
|
|||||||
echo "使用 Rust 构建目标: $BUILD_TARGET"
|
echo "使用 Rust 构建目标: $BUILD_TARGET"
|
||||||
rustc -V
|
rustc -V
|
||||||
cargo -V
|
cargo -V
|
||||||
|
mkdir -p "$HOME/.cargo"
|
||||||
|
printf '%s\n' \
|
||||||
|
'[source.crates-io]' \
|
||||||
|
'replace-with = "rsproxy-sparse"' \
|
||||||
|
'' \
|
||||||
|
'[source.rsproxy-sparse]' \
|
||||||
|
'registry = "sparse+https://rsproxy.cn/index/"' \
|
||||||
|
>"$HOME/.cargo/config.toml"
|
||||||
|
|
||||||
- name: 构建发布包
|
- name: 构建发布包
|
||||||
|
env:
|
||||||
|
RUSTUP_DIST_SERVER: https://rsproxy.cn
|
||||||
|
RUSTUP_UPDATE_ROOT: https://rsproxy.cn/rustup
|
||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
PATH_BASE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
. "$HOME/.cargo/env"
|
||||||
PATH_EXTRA=""
|
|
||||||
OLD_IFS="$IFS"
|
|
||||||
IFS=':'
|
|
||||||
set -- $PATH
|
|
||||||
IFS="$OLD_IFS"
|
|
||||||
for entry in "$@"; do
|
|
||||||
[ -n "$entry" ] || continue
|
|
||||||
[ "$entry" = "$HOME/.cargo/bin" ] && continue
|
|
||||||
case ":$PATH_BASE:$PATH_EXTRA:" in
|
|
||||||
*":$entry:"*) continue ;;
|
|
||||||
esac
|
|
||||||
PATH_EXTRA="${PATH_EXTRA:+$PATH_EXTRA:}$entry"
|
|
||||||
done
|
|
||||||
export PATH="$PATH_BASE${PATH_EXTRA:+:$PATH_EXTRA}"
|
|
||||||
if ! command -v cargo >/dev/null 2>&1 || ! command -v rustc >/dev/null 2>&1; then
|
|
||||||
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
|
||||||
fi
|
|
||||||
cd lightops-src
|
cd lightops-src
|
||||||
TAG="$(cat /tmp/lightops-release-tag)"
|
TAG="$(cat /tmp/lightops-release-tag)"
|
||||||
VERSION="${TAG#v}"
|
VERSION="${TAG#v}"
|
||||||
|
|||||||
Reference in New Issue
Block a user