Install protoc without sudo on self-hosted runners
The daemon job assumed a GitHub-hosted runner, where the build user is unprivileged and sudo exists. Our act runner is a container that runs as root and ships no sudo, so the step died with "sudo: command not found" before the toolchain was ever installed — which also blocked the publish job that waits on it. Use sudo only when we are not already root, so the step works on both.
This commit is contained in:
@@ -56,8 +56,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Self-hosted act runners run as root in a container that has no sudo,
|
||||||
|
# while GitHub-hosted runners need it. Pick whichever exists.
|
||||||
- name: Install protoc
|
- name: Install protoc
|
||||||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
run: |
|
||||||
|
SUDO=""
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then SUDO="sudo"; fi
|
||||||
|
$SUDO apt-get update
|
||||||
|
$SUDO apt-get install -y protobuf-compiler
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user