mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-24 11:01:33 -08:00
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
# Copyright 2026 Element Creations Ltd
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
name: Cache ASDF and Tools
|
|
|
|
description: 'Cache ASDF and the setup tools'
|
|
inputs:
|
|
tool-versions:
|
|
description: '.tools-versions file to cache'
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Get current week number and home dir
|
|
id: cache-input
|
|
shell: bash
|
|
run: |
|
|
echo "week=$(date +%Y%U)" | tee -a "$GITHUB_OUTPUT"
|
|
echo "runner-home=$HOME" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache ASDF for a week
|
|
id: asdf-cache
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
|
|
env:
|
|
gh_cache_prefix: ${{ runner.os }}-${{ runner.arch }}-asdf-
|
|
with:
|
|
key: ${{ env.gh_cache_prefix }}week-${{ steps.cache-input.outputs.week }}
|
|
path: |
|
|
${{ steps.cache-input.outputs.runner-home }}/.asdf/bin
|
|
|
|
- name: set up ASDF
|
|
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47 # v4
|
|
with:
|
|
skip_install: ${{ steps.asdf-cache.outputs.cache-hit == 'true' }}
|
|
|
|
- name: Write asdf .tool-versions
|
|
id: write-asdf-tools
|
|
env:
|
|
ASDF_TOOLS: ${{ inputs.tool-versions }}
|
|
shell: bash
|
|
run: |
|
|
echo "$ASDF_TOOLS" | tee -a ".tool-versions"
|
|
echo "tools-hash=$(sha256sum .tool-versions | cut -d ' ' -f 1)" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore ASDF tools from cache
|
|
id: asdf-tools-cache
|
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
|
|
env:
|
|
gh_cache_prefix: ${{ runner.os }}-${{ runner.arch }}-asdf-tools-
|
|
with:
|
|
key: ${{ env.gh_cache_prefix }}${{ steps.write-asdf-tools.outputs.tools-hash }}
|
|
path: |
|
|
${{ env.ASDF_DIR }}/plugins
|
|
${{ env.ASDF_DIR }}/installs
|
|
|
|
- name: Install ASDF tools
|
|
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47 # v4
|
|
|
|
- name: Reshim installed ASDF tools
|
|
shell: bash
|
|
run: asdf reshim
|