Skip to content

Commit

Permalink
Fix install-dir when using the default
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofranssen committed Mar 31, 2022
1 parent e86ddb1 commit 4df5c3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions installer-action/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ inputs:
install-dir:
description: 'Where to install the fatt binary'
required: false
default: '$HOME/.fatt/bin'
default: "$HOME/.fatt/bin"
runs:
using: 'composite'
steps:
# To expand the $HOME environment variable when setting the INSTALL_PATH variable
# this way of adding to the GITHUB_ENV is required. Via yaml syntax 'env: …' will
# not work and result in a relative install-dir like
# /home/runner/work/slsa-workflow-examples/slsa-workflow-examples/$HOME/.fatt/bin.
# where you would expect /home/runner/.fatt/bin
- shell: bash
run: echo "INSTALL_PATH=${{ inputs.install-dir }}" >> $GITHUB_ENV
- shell: bash
run: $GITHUB_ACTION_PATH/install.sh
env:
VERSION: ${{ inputs.fatt-release }}
INSTALL_PATH: ${{ inputs.install-dir }}
- if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: |
echo "${{ inputs.install-dir }}" >> $GITHUB_PATH
echo "binary installed at $(command -v fatt)"
run: echo "${{ inputs.install-dir }}" >> $GITHUB_PATH
shell: bash
- if: ${{ runner.os == 'Windows' }}
run: echo "${{ inputs.install-dir }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
run: echo "${{ inputs.install-dir }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
6 changes: 3 additions & 3 deletions installer-action/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ set -e
GITHUB_API=${GITHUB_API:-'https://api.github.com'}

# default to relative path if INSTALL_PATH is not set
INSTALL_PATH=${INSTALL_PATH:-./.fatt/bin}
# INSTALL_PATH=${INSTALL_PATH:-./.fatt/bin}
mkdir -p "${INSTALL_PATH}"
INSTALL_PATH="$(realpath "${INSTALL_PATH}")"
# INSTALL_PATH="$(realpath "${INSTALL_PATH}")"

VERSION="${VERSION:-v0.2.0-rc}"
RELEASE="https://github.com/philips-labs/fatt/releases/download/${VERSION}"
Expand Down Expand Up @@ -81,7 +81,7 @@ DOWNLOAD="${RELEASE}/${ARCHIVE}"
log_info "Installing ${BINARY} (${OS}/${ARCH}) at ${INSTALL_PATH}"

trap "popd >/dev/null" EXIT
pushd "$INSTALL_PATH" >/dev/null || exit
pushd "${INSTALL_PATH}" || exit

download "${ARCHIVE}" "${DOWNLOAD}"

Expand Down

0 comments on commit 4df5c3b

Please sign in to comment.