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 3fc33e2
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 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@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,28 +94,18 @@ 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
with:
folder_name: balena-cli
cache_hit: ${{ steps.cache.outputs.cache-hit }}

- name: Save balena CLI cache
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}}

- name: Print balena CLI version
shell: bash
working-directory: ${{ runner.temp }}
run: |
echo "$PATH"
find "${{ runner.tool_cache }}/balena-cli"
balena version
run: balena version

- name: Login to balenaCloud
if: inputs.balena-token != ''
Expand Down

0 comments on commit 3fc33e2

Please sign in to comment.