Skip to content

Commit

Permalink
GitHub Action: use latest version (unless version is specified)
Browse files Browse the repository at this point in the history
...to lower the maintenance need for this action (keeping it updated when there's newer versions of Octopilot released).

Signed-off-by: Victor Sollerhed <victor.sollerhed@pagero.com>
  • Loading branch information
MPV committed Oct 18, 2023
1 parent 4f74d8a commit f4dce51
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ description: Download and install Octopilot (https://github.com/dailymotion-oss/
inputs:
version:
required: false
default: "1.2.23"
description: Octopilot version to install (https://github.com/dailymotion-oss/octopilot/releases)
description: "Octopilot version to install, e.g. '1.2.23' (https://github.com/dailymotion-oss/octopilot/releases)"
runs:
using: composite
steps:
- name: Determine version
shell: bash
env:
VERSION: ${{ inputs.version }}
run: |
if [ -z "${VERSION}" ]; then
echo "Looking for latest version of Octopilot at https://github.com/dailymotion-oss/octopilot/releases/latest"
VERSION=$(curl -sI https://github.com/dailymotion-oss/octopilot/releases/latest | grep "location: " | sed 's:.*/::' | tr -d '\r')
fi
# Remove any 'v' prefix:
VERSION="${VERSION/#v}"
echo "Found Octopilot version '${VERSION}'."
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
- name: Download
shell: bash
run: |
echo "Downloading Octopilot version '${VERSION}' from https://github.com/dailymotion-oss/octopilot/releases/tag/v${VERSION}"
curl -fLO https://github.com/dailymotion-oss/octopilot/releases/download/v${VERSION}/octopilot_${VERSION}_checksums.txt
curl -fLO https://github.com/dailymotion-oss/octopilot/releases/download/v${VERSION}/octopilot_${VERSION}_linux_amd64
check=$(sha256sum -c octopilot_${VERSION}_checksums.txt 2>&1 || true)
grep "OK" <<< "$check"
env:
VERSION: ${{ inputs.version }}
- name: Add to $PATH
shell: bash
run: |
mkdir -p .octopilot/bin
mv octopilot_${VERSION}_linux_amd64 .octopilot/bin/octopilot
chmod +x .octopilot/bin/octopilot
realpath .octopilot/bin >> "$GITHUB_PATH"
env:
VERSION: ${{ inputs.version }}

0 comments on commit f4dce51

Please sign in to comment.