CI / Linux ARM64 (push) Waiting to run
CI / macOS ARM64 (push) Waiting to run
CI / Windows x64 (push) Waiting to run
CI / Linux x64 (push) Failing after 4s
82 lines
3.2 KiB
YAML
82 lines
3.2 KiB
YAML
name: install dotslash
|
|
author: Jon Janzen
|
|
description: Prebuilt binaries of https://dotslash-cli.com
|
|
branding:
|
|
icon: activity
|
|
color: purple
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- id: configure
|
|
run: |
|
|
platform=${{runner.os == 'macOS' && 'macos' || runner.os == 'Windows' && 'windows' || runner.arch == 'ARM64' && 'ubuntu-22.04.arm64' || 'ubuntu-22.04.x86_64'}}
|
|
release_json="${{runner.temp}}/install-dotslash-release.json"
|
|
curl https://api.github.com/repos/facebook/dotslash/releases/latest \
|
|
--header "authorization: Bearer ${{ github.token }}" \
|
|
--output "$release_json" \
|
|
--location --silent --show-error --fail --retry 5
|
|
release=$(tr -d '\n' < "$release_json")
|
|
version=$(printf '%s\n' "$release" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')
|
|
asset="dotslash-${platform}.${version}.tar.gz"
|
|
digest=$(printf '%s\n' "$release" | tr ',' '\n' | awk -v asset="$asset" '
|
|
/"name"[[:space:]]*:[[:space:]]*"/ {
|
|
value = $0
|
|
sub(/.*"name"[[:space:]]*:[[:space:]]*"/, "", value)
|
|
sub(/".*/, "", value)
|
|
found = value == asset
|
|
}
|
|
found && /"digest"[[:space:]]*:[[:space:]]*"/ {
|
|
value = $0
|
|
sub(/.*"digest"[[:space:]]*:[[:space:]]*"/, "", value)
|
|
sub(/".*/, "", value)
|
|
print value
|
|
exit
|
|
}
|
|
')
|
|
if [ -z "$version" ] || [ -z "$digest" ]; then
|
|
echo "failed to resolve DotSlash release asset digest for $asset" >&2
|
|
exit 1
|
|
fi
|
|
echo platform="$platform" >> $GITHUB_OUTPUT
|
|
echo version="$version" >> $GITHUB_OUTPUT
|
|
echo asset="$asset" >> $GITHUB_OUTPUT
|
|
echo digest="$digest" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- run: mkdir -p "${{runner.temp}}/install-dotslash/bin"
|
|
shell: bash
|
|
|
|
- run: |
|
|
curl https://github.com/facebook/dotslash/releases/download/${{steps.configure.outputs.version}}/${{steps.configure.outputs.asset}} \
|
|
--header "authorization: Bearer ${{ github.token }}" \
|
|
--output "${{runner.temp}}/install-dotslash/dotslash.tar.gz" \
|
|
--location --silent --show-error --fail --retry 5
|
|
shell: bash
|
|
|
|
- run: |
|
|
expected="${{steps.configure.outputs.digest}}"
|
|
expected_sha256="${expected#sha256:}"
|
|
archive="${{runner.temp}}/install-dotslash/dotslash.tar.gz"
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
echo "$expected_sha256 $archive" | sha256sum --check
|
|
else
|
|
actual_sha256=$(shasum -a 256 "$archive" | cut -d ' ' -f 1)
|
|
test "$actual_sha256" = "$expected_sha256"
|
|
fi
|
|
shell: bash
|
|
|
|
- run: tar xvf "${{runner.temp}}/install-dotslash/dotslash.tar.gz" -C "${{runner.temp}}/install-dotslash/bin/"
|
|
if: ${{runner.os != 'Windows'}}
|
|
shell: bash
|
|
|
|
- run: tar xvf "${{runner.temp}}/install-dotslash/dotslash.tar.gz" -O >"${{runner.temp}}/install-dotslash/bin/dotslash.exe" --force-local
|
|
if: ${{runner.os == 'Windows'}}
|
|
shell: bash
|
|
|
|
- run: echo "${{runner.temp}}/install-dotslash/bin" >> $GITHUB_PATH
|
|
shell: bash
|
|
|
|
- run: dotslash --version
|
|
shell: bash
|