Skip to content

Commit

Permalink
Merge branch 'main' into fix/update-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leiicamundi authored Feb 5, 2025
2 parents c76928d + e9a9f33 commit 8e063d8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/actions/asdf-install-tooling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This action will:
| --- | --- | --- | --- |
| `version` | <p>asdf version</p> | `false` | `v0.16.1` |
| `os` | <p>Target OS (linux or darwin)</p> | `false` | `linux` |
| `arch` | <p>Target architecture (amd64, arm64, etc.)</p> | `false` | `amd64` |
| `arch` | <p>Target architecture (amd64, arm64, etc.). Default will try to detect runner arch.</p> | `false` | `auto` |
| `cache` | <p>Use cache for tools installed</p> | `false` | `true` |


Expand All @@ -44,10 +44,10 @@ This action is a `composite` action.
# Default: linux

arch:
# Target architecture (amd64, arm64, etc.)
# Target architecture (amd64, arm64, etc.). Default will try to detect runner arch.
#
# Required: false
# Default: amd64
# Default: auto

cache:
# Use cache for tools installed
Expand Down
25 changes: 21 additions & 4 deletions .github/actions/asdf-install-tooling/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,39 @@ inputs:
description: Target OS (linux or darwin)
default: linux
arch:
description: Target architecture (amd64, arm64, etc.)
default: amd64
description: Target architecture (amd64, arm64, etc.). Default will try to detect runner arch.
default: auto
cache:
description: Use cache for tools installed
default: 'true'

runs:
using: composite
steps:
- name: Detect architecture if auto
id: detect-arch
shell: bash
run: |
if [[ "${{ inputs.arch }}" == "auto" ]]; then
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
echo "Detected architecture: $ARCH"
else
ARCH="${{ inputs.arch }}"
fi
echo "arch=$ARCH" | tee -a "$GITHUB_OUTPUT"
- name: Compute cache key
id: cache-key
shell: bash
run: |
WEEK_NUMBER="$(date +%V)"
echo "cache_key=${{ runner.os }}-${{ inputs.version }}-tooling-${{ hashFiles('**/.tool-versions') }}-week-${WEEK_NUMBER}" | tee -a "$GITHUB_OUTPUT"
echo "cache_key=${{ runner.os }}-${{ steps.detect-arch.outputs.arch }}-${{ inputs.version }}-tooling-${{ hashFiles('**/.tool-versions') }}-week-${WEEK_NUMBER}" | tee -a "$GITHUB_OUTPUT"
echo "cache_asdf_path=$HOME/.asdf" | tee -a "$GITHUB_OUTPUT"
echo "cache_asdf_bin_path=$HOME/.local/bin/asdf" | tee -a "$GITHUB_OUTPUT"
Expand All @@ -58,7 +75,7 @@ runs:
set -euxo pipefail
# Variables
FILE_NAME="asdf-${{ inputs.version }}-${{ inputs.os }}-${{ inputs.arch }}.tar.gz"
FILE_NAME="asdf-${{ inputs.version }}-${{ inputs.os }}-${{ steps.detect-arch.outputs.arch }}.tar.gz"
DOWNLOAD_URL="https://github.com/asdf-vm/asdf/releases/download/${{ inputs.version }}/${FILE_NAME}"
MD5_URL="${DOWNLOAD_URL}.md5"
Expand Down

0 comments on commit 8e063d8

Please sign in to comment.