Skip to content

Commit

Permalink
Add installing svn if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
nebularg committed Dec 19, 2024
1 parent edbd9c0 commit 6b07139
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ inputs:
runs:
using: composite
steps:
- run: INPUT_PANDOC=${{ inputs.pandoc }} $GITHUB_ACTION_PATH/setup-packager.sh
- run: $GITHUB_ACTION_PATH/setup-packager.sh
env:
INPUT_PANDOC: ${{ inputs.pandoc }}
INPUT_ARGS: ${{ inputs.args }}
shell: bash
- run: $GITHUB_ACTION_PATH/release.sh ${{ inputs.args }}
shell: bash
34 changes: 34 additions & 0 deletions setup-packager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,40 @@ install_pandoc() {
fi
}

# Install subversion if the pkgmeta includes external svn repos
install_subversion() {
command -v svn &>/dev/null && return 0

local pkgmeta_file
local OPTIND
while getopts ":m:" opt "$INPUT_ARGS"; do
case $opt in
m)
pkgmeta_file="${GITHUB_WORKSPACE}/${OPTARG}"
[[ ! -f "$pkgmeta_file" ]] && return 0
;;
*)
esac
done
if [[ -z "$pkgmeta_file" ]]; then
if [[ -f "${GITHUB_WORKSPACE}/.pkgmeta" ]]; then
pkgmeta_file="${GITHUB_WORKSPACE}/.pkgmeta"
elif [[ -f "${GITHUB_WORKSPACE}/pkgmeta.yaml" ]]; then
pkgmeta_file="${GITHUB_WORKSPACE}/pkgmeta.yaml"
else
return 0
fi
fi

# check type then url, exit 1 if no matches
if yq -e '.externals | ( (.[] | select(.type == "svn")) or (with_entries(.value |= .url) | .[] | select(test(".*/trunk(?:/|$)"))) )' < "$pkgmeta_file" &>/dev/null; then
# echo "::notice title=GitHub Actions Change::The runner image for ubuntu-latest is being updated to use ubuntu-24.04, which no longer includes subversion." \
# "Update your workflow \"run-as\" to use ubuntu-22.04 directly or add a step to install subversion to continue support for svn repositories."
sudo apt-get install -yq subversion &>/dev/null && echo -e "##[group]Install subversion\\n[command]svn --version\\n$( svn --version )\\n##[endgroup]"
fi
}

if [[ -n $GITHUB_ACTIONS ]]; then
install_pandoc
install_subversion
fi

0 comments on commit 6b07139

Please sign in to comment.