From f0fe5f5fd1760222ae96f56d45ba6c03883b5a7d Mon Sep 17 00:00:00 2001 From: Echo Date: Fri, 24 Apr 2026 15:25:33 +0000 Subject: [PATCH] ci: Use conditional sudo for apt-get in all jobs - Some jobs run as root (no sudo needed), others as echo user (sudo required) - Added SUDO detection: SUDO=; [ 0 -ne 0 ] && SUDO=sudo - Fixed remaining unfixed apt-get call in build-and-release job --- .gitea/workflows/ci.yml | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d0c9230..f7e9160 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -20,8 +20,9 @@ jobs: steps: - name: Install checkout dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends curl ca-certificates + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends curl ca-certificates - name: Checkout repository run: | @@ -54,8 +55,9 @@ jobs: steps: - name: Install checkout dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends curl ca-certificates + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends curl ca-certificates - name: Checkout repository run: | @@ -68,8 +70,9 @@ jobs: - name: Install system dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends pkg-config libssl-dev + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends pkg-config libssl-dev - name: Ensure Rust toolchain run: | @@ -102,8 +105,9 @@ jobs: steps: - name: Install checkout dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends curl ca-certificates + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends curl ca-certificates - name: Checkout repository run: | @@ -116,8 +120,9 @@ jobs: - name: Install system dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends pkg-config libssl-dev + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends pkg-config libssl-dev - name: Ensure Rust toolchain run: | @@ -139,8 +144,9 @@ jobs: steps: - name: Install checkout dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends curl ca-certificates + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends curl ca-certificates - name: Checkout repository run: | @@ -175,8 +181,9 @@ jobs: steps: - name: Install checkout dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends curl ca-certificates + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends curl ca-certificates - name: Checkout repository run: | @@ -209,8 +216,9 @@ jobs: steps: - name: Install system dependencies run: | - apt-get update -qq - apt-get install -y --no-install-recommends \ + SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends \ curl pkg-config libssl-dev ca-certificates \ git nodejs npm dpkg-dev python3