Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion get-tool-version.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#! /bin/bash
# Resolve the tool release version from go.mod
# without requiring go to be installed.
#
# Notice that when executed on github runner, this folder
# is not a git directory. So usual git commands are not available.

tool=${1?-Tool name is a required argument}

Expand All @@ -20,5 +23,5 @@ case "${tool}" in
;;
esac

root=$(git rev-parse --show-toplevel)
root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
grep "${GO_IMPORT_PATH}" "${root}"/go.mod|xargs|cut -d' ' -f2
2 changes: 1 addition & 1 deletion install/go-ctrf-json-reporter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ runs:
VERSION_RESOLVER: '${{ github.action_path }}/../../get-tool-version.sh'
run: |
if [[ '${{ !inputs.version }}' == 'true' || '${{ inputs.version }}' == 'auto' ]] ; then
VERSION=$("${VERSION_RESOLVER}" "${TOOL}")
VERSION=$("${VERSION_RESOLVER}" "${TOOL}")
else
VERSION='${{ inputs.version }}'
fi
Expand Down
16 changes: 13 additions & 3 deletions install/go-junit-report/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,23 @@ runs:

set -x
# e.g. go-junit-report-v2.1.0-darwin-arm64.tar.gz
ARCHIVE_FORMAT=".tar.gz"
if [[ '${{ runner.os }}' == 'Windows' ]] ; then
ARCHIVE_FORMAT=".zip"
fi

gh release download "${VERSION}" \
--repo "${REPO}" \
--pattern "*-${OS}-${ARCH}.tar.gz" \
--output "${DOWNLOAD_DIR}"/artifact.tgz
--pattern "*-${OS}-${ARCH}${ARCHIVE_FORMAT}" \
--output "${DOWNLOAD_DIR}"/"artifact${ARCHIVE_FORMAT}"

# should check checksum etc
(cd "${DOWNLOAD_DIR}" && tar xf artifact.tgz "${TOOL}" && rm -f artifact.tgz)
if [[ "${OS}" != 'windows' ]] ; then
(cd "${DOWNLOAD_DIR}" && tar xf "artifact${ARCHIVE_FORMAT}" "${TOOL}" && rm -f "artifact${ARCHIVE_FORMAT}")
else
TOOL="${TOOL}.exe"
(cd "${DOWNLOAD_DIR}" && unzip "artifact${ARCHIVE_FORMAT}" "${TOOL}" && rm -f "artifact${ARCHIVE_FORMAT}")
fi

mkdir -p "${TARGET_DIR}"
mv "${DOWNLOAD_DIR}"/"${TOOL}" "${TARGET_DIR}"
Expand Down
11 changes: 7 additions & 4 deletions install/gotestsum/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,18 @@ runs:

mkdir -p "${DOWNLOAD_DIR}"

set -x
ARCHIVE_FORMAT=".tar.gz"
# e.g. gotestsum_1.13.0_linux_amd64.tar.gz
gh release download "${VERSION}" \
--repo "${REPO}" \
--pattern "*_${OS}_${ARCH}.tar.gz" \
--output "${DOWNLOAD_DIR}"/artifact.tgz
--pattern "*_${OS}_${ARCH}${ARCHIVE_FORMAT}" \
--output "${DOWNLOAD_DIR}"/"artifact${ARCHIVE_FORMAT}"

# should check checksum etc
(cd "${DOWNLOAD_DIR}" && tar xf artifact.tgz "${TOOL}" && rm -f artifact.tgz)
if [[ "${OS}" == 'windows' ]] ; then
TOOL="${TOOL}.exe"
fi
(cd "${DOWNLOAD_DIR}" && tar xf "artifact${ARCHIVE_FORMAT}" "${TOOL}" && rm -f "artifact${ARCHIVE_FORMAT}")

mkdir -p "${TARGET_DIR}"
mv "${DOWNLOAD_DIR}"/"${TOOL}" "${TARGET_DIR}"
Expand Down
Loading