-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
103 lines (92 loc) · 4.22 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
95
96
97
98
99
100
101
102
103
name: Install
description: Installs Meteor and npm dependencies
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: '.'
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_RELEASE 📻
shell: bash
run: echo "METEOR_LOCAL_RELEASE=$(sed -n 's/^METEOR@\([0-9][0-9]*.*\)$/\1/p' ${{ env.METEOR_RELEASE_PATH }})" >> $GITHUB_ENV
- 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 ~/.npm 📀
uses: actions/cache@v4
env:
cache-name: cache-npm
with:
path: ~/.npm
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-
${{ runner.os }}-${{ env.cache-name }}-
- name: Cache ${{ inputs.working-directory }}/node_modules 💽
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ${{ inputs.working-directory }}/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.METEOR_EXECUTABLE_VERSION }}-
${{ runner.os }}-${{ env.cache-name }}-
- name: Keep a copy of `package-lock.json` 🗃️
working-directory: ${{ inputs.working-directory }}
shell: bash
run: |
cp package-lock.json "${RUNNER_TEMP}/"
- name: Install dependencies (meteor npm install) 📦
working-directory: ${{ inputs.working-directory }}
shell: bash
run: |
meteor npm install
- name: Check if `package-lock.json` has been modified 🔒
continue-on-error: true
id: diff
working-directory: ${{ inputs.working-directory }}
shell: bash
run: |
diff package-lock.json "${RUNNER_TEMP}/package-lock.json"
- name: Install dependencies (meteor npm clean-install) 📦
if: steps.diff.outcome == 'failure'
working-directory: ${{ inputs.working-directory }}
shell: bash
run: |
cp "${RUNNER_TEMP}/package-lock.json" package-lock.json
meteor npm clean-install