Skip to content

Commit

Permalink
Fix extract path
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Apr 22, 2024
1 parent 9363d58 commit 48ba476
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@ inputs:
balena-token:
description: "balenaCloud API token to login automatically"
required: false
skip-cache:
description: "Skip using the tool cache and always re-download"
required: false

# Builds and then runs as separate steps as default GitHub method does not allow passing build args
runs:
using: "composite"
steps:
- name: Restore balena CLI cache
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.tool_cache }}/balena-cli
key: balena-cli-${{ runner.os }}-${{ runner.arch }}

- name: Get latest release
if: ${{ inputs.cli-version }} != 'latest' || ${{ inputs.cli-version }} != ''
if: inputs.cli-version != 'latest' || inputs.cli-version != ''
id: latest
shell: bash
working-directory: ${{ runner.temp }}
run: |
release="$(curl -s https://api.github.com/repos/balena-io/balena-cli/releases/latest | jq -r '.tag_name')"
echo "release=${release}" >> "${GITHUB_OUTPUT}"
- name: Restore balena CLI cache
if: inputs.skip-cache == 'true'
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ runner.tool_cache }}/balena-cli
key: balena-cli-${{ runner.os }}-${{ runner.arch }}-${{ steps.latest.outputs.release || inputs.cli-version }}

- name: Download balena CLI (Linux X64)
if: runner.os == 'Linux' && runner.arch == 'x64' && ! steps.cache.outputs.cache-hit
working-directory: ${{ runner.temp }}
Expand All @@ -42,7 +46,7 @@ runs:
run: |
set -x
curl -fsSL "${REPO}/releases/download/${VERSION}/balena-cli-${VERSION}-linux-x64-standalone.zip" -o balena-cli.zip
unzip balena-cli.zip -d balena-cli
unzip balena-cli.zip -d .
- name: Download balena CLI (Linux ARM64)
if: runner.os == 'Linux' && runner.arch == 'ARM64' && ! steps.cache.outputs.cache-hit
Expand All @@ -54,7 +58,7 @@ runs:
run: |
set -x
curl -fsSL "${REPO}/releases/download/${VERSION}/balena-cli-${VERSION}-linux-arm64-standalone.zip" -o balena-cli.zip
unzip balena-cli.zip -d balena-cli
unzip balena-cli.zip -d .
- name: Download balena CLI (Windows X64)
if: runner.os == 'Windows' && runner.arch == 'x64' && ! steps.cache.outputs.cache-hit
Expand All @@ -66,7 +70,7 @@ runs:
run: |
set -x
curl -fsSL "${REPO}/releases/download/${VERSION}/balena-cli-${VERSION}-windows-x64-standalone.zip" -o balena-cli.zip
unzip balena-cli.zip -d balena-cli
unzip balena-cli.zip -d .
- name: Download balena CLI (macOS X64)
if: runner.os == 'macOS' && runner.arch == 'x64' && ! steps.cache.outputs.cache-hit
Expand All @@ -78,7 +82,7 @@ runs:
run: |
set -x
curl -fsSL "${REPO}/releases/download/${VERSION}/balena-cli-${VERSION}-macOS-x64-standalone.zip" -o balena-cli.zip
unzip balena-cli.zip -d balena-cli
unzip balena-cli.zip -d .
- name: Download balena CLI (macOS ARM64)
if: runner.os == 'macOS' && runner.arch == 'ARM64' && ! steps.cache.outputs.cache-hit
Expand All @@ -90,7 +94,7 @@ runs:
run: |
set -x
curl -fsSL "${REPO}/releases/download/${VERSION}/balena-cli-${VERSION}-macOS-arm64-standalone.zip" -o balena-cli.zip
unzip balena-cli.zip -d balena-cli
unzip balena-cli.zip -d .
- name: Install balena CLI to tool cache
uses: AnimMouse/tool-cache@v1
Expand All @@ -99,11 +103,11 @@ runs:
cache_hit: ${{ steps.cache.outputs.cache-hit }}

- name: Save balena CLI cache
if: '! steps.cache.outputs.cache-hit'
if: "! steps.cache.outputs.cache-hit"
uses: actions/cache/save@v4
with:
path: ${{ runner.tool_cache }}/balena-cli
key: balena-cli-${{ runner.os }}-${{ runner.arch}}
key: balena-cli-${{ runner.os }}-${{ runner.arch }}-${{ steps.latest.outputs.release || inputs.cli-version }}

- name: Print balena CLI version
shell: bash
Expand Down

0 comments on commit 48ba476

Please sign in to comment.