Fix Forgejo release workflow for Docker executor.
Some checks failed
Forgejo Release Builder / release (push) Failing after 3m15s
Some checks failed
Forgejo Release Builder / release (push) Failing after 3m15s
Use a container-reachable Forgejo checkout URL and support package installs via root or sudo in container jobs.
This commit is contained in:
parent
1f554081a5
commit
5396ebad7c
1 changed files with 17 additions and 6 deletions
|
|
@ -25,7 +25,8 @@ jobs:
|
|||
set -euo pipefail
|
||||
rm -rf .git
|
||||
git init .
|
||||
git remote add origin "http://copilot:${FORGEJO_TOKEN}@127.0.0.1:3030/${GITHUB_REPOSITORY}.git"
|
||||
git config --global http.sslVerify false
|
||||
git remote add origin "https://copilot:${FORGEJO_TOKEN}@192.168.1.155:3030/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --tags --prune --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout --force FETCH_HEAD
|
||||
|
||||
|
|
@ -33,18 +34,28 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
pkg_install() {
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
"$@"
|
||||
elif command -v sudo >/dev/null 2>&1; then
|
||||
sudo "$@"
|
||||
else
|
||||
echo "Need root or sudo to install packages."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
if command -v java >/dev/null 2>&1; then
|
||||
java -version
|
||||
else
|
||||
if command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y java-17-openjdk-devel
|
||||
pkg_install dnf install -y java-17-openjdk-devel
|
||||
elif command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update
|
||||
apt-get install -y openjdk-17-jdk
|
||||
pkg_install apt-get update
|
||||
pkg_install apt-get install -y openjdk-17-jdk
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
apk add --no-cache openjdk17
|
||||
pkg_install apk add --no-cache openjdk17
|
||||
elif command -v pacman >/dev/null 2>&1; then
|
||||
pacman -Sy --noconfirm jdk17-openjdk
|
||||
pkg_install pacman -Sy --noconfirm jdk17-openjdk
|
||||
else
|
||||
echo "No supported package manager found for JDK installation."
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue