forked from ai/asdf-cache-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
76 lines (68 loc) · 2.09 KB
/
action.yml
File metadata and controls
76 lines (68 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Install tools from asdf config
description: Install runtimes and dependencies by asdf CLI with a cache
author: Andrey Sitnik, Codeur SAS
branding:
icon: download
color: blue
inputs:
ruby-version:
description: Ruby version to install
required: false
nodejs-version:
description: Node.js version to install
required: false
runs:
using: "composite"
steps:
- name: Check if version inputs are present
id: custom-versions
shell: bash
run: |
if [ -n "${{ inputs.ruby-version }}" ]; then
echo "detected=true" >> $GITHUB_OUTPUT
fi
if [ -n "${{ inputs.nodejs-version }}" ]; then
echo "detected=true" >> $GITHUB_OUTPUT
fi
- name: Rewrite .tool-versions if custom versions are present
if: steps.custom-versions.outputs.detected == 'true'
shell: bash
run: |
echo "# Generated by asdf-vm/actions/setup@v3" > .tool-versions
echo "ruby ${{ inputs.ruby-version }}" >> .tool-versions
echo "nodejs ${{ inputs.nodejs-version }}" >> .tool-versions
- name: Install asdf
uses: asdf-vm/actions/setup@v3
- name: Cache asdf
id: cache
uses: actions/cache@v4
with:
path: ~/.asdf
key: asdf-${{ hashFiles('**/.tool-versions') }}
- name: Install asdf tools
if: steps.cache.outputs.cache-hit != 'true'
uses: asdf-vm/actions/install@v3
- name: Check if ruby is present
id: ruby
shell: bash
run: |
if grep --quiet "^ruby " .tool-versions; then
echo "detected=true" >> $GITHUB_OUTPUT
fi
- name: Install gems with bundler
if: steps.ruby.outputs.detected == 'true'
shell: bash
run: |
bundle install --jobs 4 --retry 3
- name: Check if nodejs is present
id: nodejs
shell: bash
run: |
if grep --quiet "^nodejs " .tool-versions; then
echo "detected=true" >> $GITHUB_OUTPUT
fi
- name: Install nodejs packages with yarn
if: steps.nodejs.outputs.detected == 'true'
shell: bash
run: |
yarn install