-
Notifications
You must be signed in to change notification settings - Fork 23
/
action.yml
38 lines (37 loc) · 1.66 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Setup Octopilot
description: Download and install Octopilot (https://github.com/dailymotion-oss/octopilot)
inputs:
version:
required: false
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"
- 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"