Install PowerShell in Gitea build runner
This commit is contained in:
@@ -45,6 +45,39 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dotnet-version: "10.0.x"
|
dotnet-version: "10.0.x"
|
||||||
|
|
||||||
|
- name: Install PowerShell
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if command -v pwsh >/dev/null 2>&1; then
|
||||||
|
pwsh --version
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
SUDO=""
|
||||||
|
elif command -v sudo >/dev/null 2>&1; then
|
||||||
|
SUDO="sudo"
|
||||||
|
else
|
||||||
|
echo "PowerShell is missing and this runner cannot install packages."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
. /etc/os-release
|
||||||
|
case "$ID" in
|
||||||
|
ubuntu) MICROSOFT_REPO="https://packages.microsoft.com/config/ubuntu/${VERSION_ID}/packages-microsoft-prod.deb" ;;
|
||||||
|
debian) MICROSOFT_REPO="https://packages.microsoft.com/config/debian/${VERSION_ID}/packages-microsoft-prod.deb" ;;
|
||||||
|
*) echo "Unsupported runner distribution: $ID"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
$SUDO apt-get update
|
||||||
|
$SUDO apt-get install -y ca-certificates curl
|
||||||
|
curl -fsSL "$MICROSOFT_REPO" -o /tmp/packages-microsoft-prod.deb
|
||||||
|
$SUDO dpkg -i /tmp/packages-microsoft-prod.deb
|
||||||
|
$SUDO apt-get update
|
||||||
|
$SUDO apt-get install -y powershell
|
||||||
|
pwsh --version
|
||||||
|
|
||||||
- name: Build client package
|
- name: Build client package
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user