diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index bb74a73..e91a2f3 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -48,40 +48,24 @@ jobs: set -eux if command -v apt-get >/dev/null 2>&1; then 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 - 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 - 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 - 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 - name: 安装 Rust run: | set -eux - PATH_BASE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - 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 + if ! command -v rustup >/dev/null 2>&1; then curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal - . "$HOME/.cargo/env" 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')" BUILD_TARGET="$HOST_TARGET" if [ "$HOST_TARGET" != "x86_64-unknown-linux-gnu" ] && command -v rustup >/dev/null 2>&1; then @@ -97,24 +81,7 @@ jobs: - name: 构建发布包 run: | set -eux - PATH_BASE="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - 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 + . "$HOME/.cargo/env" cd lightops-src TAG="$(cat /tmp/lightops-release-tag)" VERSION="${TAG#v}"