forked from meteor-actions/install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
95 lines (84 loc) · 4.47 KB
/
action.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Install
description: Installs Meteor and Node With Cache enabled
inputs:
executable-version:
description: 'Meteor version for the `meteor` executable. If set to `local` or not explicitly set, the `meteor` executable will have the version specified in .meteor/release (this may not work with alpha and beta builds). You can use `latest` as an alias for the latest Meteor release.'
required: true
default: 'local'
working-directory:
required: true
default: '.'
cache-dependency-path:
description: 'Files to use as a cache key for global ~~/.npm dependencies'
required: true
default: './package-lock.json'
local-cache-key:
description: "Name assigned to the cache for meteor local when used with multiple settings"
required: true
default: ${{ github.job }}
runs:
using: composite
steps:
- name: Set $PATH
shell: bash
run: echo "$HOME/.meteor" >> $GITHUB_PATH
- name: Set env.METEOR_RELEASE_PATH 🥾
shell: bash
run: echo "METEOR_RELEASE_PATH=${{ inputs.working-directory }}/.meteor/release" >> $GITHUB_ENV
- name: Set env.METEOR_LOCAL_PATH
shell: bash
run: echo "METEOR_LOCAL_PATH=${{ inputs.working-directory }}/.meteor/local" >> $GITHUB_ENV
- name: Set env.METEOR_LOCAL_RELEASE 📻
run: echo "METEOR_LOCAL_RELEASE=$(cat ${{ env.METEOR_RELEASE_PATH }} | cut -d@ -f2)" >> $GITHUB_ENV
shell: bash
- name: Set env.METEOR_EXECUTABLE_VERSION 📺
shell: bash
run: |
if [ ${{ inputs.executable-version }} = 'local' ]; then
echo "METEOR_EXECUTABLE_VERSION=${{ env.METEOR_LOCAL_RELEASE }}" >> $GITHUB_ENV
elif [ ${{ inputs.executable-version }} = 'latest' ]; then
echo "METEOR_EXECUTABLE_VERSION=$(curl -s https://install.meteor.com | sed -n 's/^RELEASE="\(.*\)"$/\1/p')" >> $GITHUB_ENV
else
echo "METEOR_EXECUTABLE_VERSION=${{ inputs.executable-version }}" >> $GITHUB_ENV
fi
- name: Cache ~/.meteor (Meteor ${{ env.METEOR_EXECUTABLE_VERSION }} (${{ env.METEOR_RELEASE_PATH }} is ${{ env.METEOR_LOCAL_RELEASE }})) 💿
uses: actions/cache@v4
id: cache-meteor
env:
cache-name: cache-meteor
with:
path: ~/.meteor
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles(env.METEOR_RELEASE_PATH) }}-${{ hashFiles('.meteor/versions') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles(env.METEOR_RELEASE_PATH) }}-
${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-
- name: Install Meteor ${{ env.METEOR_EXECUTABLE_VERSION }} ☄️
if: steps.cache-meteor.outputs.cache-hit != 'true'
shell: bash
run: |
curl https://install.meteor.com?release=${{ env.METEOR_EXECUTABLE_VERSION }} | sh
- name: Cache ${{ env.METEOR_LOCAL_PATH }}
uses: actions/cache@v4
env:
cache-name: cache-meteor-local
with:
path: |
${{ env.METEOR_LOCAL_PATH }}/resolver-result-cache.json
${{ env.METEOR_LOCAL_PATH }}/plugin-cache
${{ env.METEOR_LOCAL_PATH }}/isopacks
${{ env.METEOR_LOCAL_PATH }}/bundler-cache/scanner
key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.local-cache-key }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles(env.METEOR_RELEASE_PATH) }}-${{ hashFiles('.meteor/versions') }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ inputs.local-cache-key }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles(env.METEOR_RELEASE_PATH) }}-${{ hashFiles('.meteor/versions') }}-${{ github.ref }}-
${{ runner.os }}-${{ env.cache-name }}-${{ inputs.local-cache-key }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles(env.METEOR_RELEASE_PATH) }}-${{ hashFiles('.meteor/versions') }}-
${{ runner.os }}-${{ env.cache-name }}-${{ inputs.local-cache-key }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles(env.METEOR_RELEASE_PATH) }}-
${{ runner.os }}-${{ env.cache-name }}-${{ inputs.local-cache-key }}-${{ env.METEOR_EXECUTABLE_VERSION }}-
- name: Get meteor node version
run: echo "NODE_VERSION=$(meteor node -v)" >> $GITHUB_ENV
shell: bash
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ inputs.cache-dependency-path}}