-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
81 lines (71 loc) · 2.85 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
name: 'Ritchie CLI Action'
description: 'Github Action to run Ritchie CLI commands on any OS runner ⚙️🖥'
inputs:
rit_formula_command:
description: 'The rit formula command line you want to run, without the rit command'
required: true
rit_repo_url:
description: 'e.g https://github.com/ZupIT/ritchie-formulas'
required: true
access_token:
description: 'Github ACCESS TOKEN with access to repository url'
required: false
runs:
using: "composite"
steps:
- name: Check Runner
run: echo 🤖 OS runner is $(uname)
shell: bash
- name: Install Ritchie CLI
run: |
if [[ "$(uname)" = "Linux" || "$(uname)" = "Darwin" ]]; then
curl -fsSL https://commons-repo.ritchiecli.io/install.sh | bash
else
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install curl[tool]
cd $GITHUB_WORKSPACE
curl https://commons-repo.ritchiecli.io/2.11.3/windows/rit.exe --output rit.exe
fi
shell: bash
- name: Initialize Ritchie CLI
run: |
if [[ "$(uname)" = "Linux" || "$(uname)" = "Darwin" ]]; then
echo '{"addCommons":false, "sendMetrics":true, "runType":"local"}' | rit init --stdin
else
cd $GITHUB_WORKSPACE
echo '{"addCommons":false, "sendMetrics":true, "runType":"local"}' | ./rit.exe init --stdin
fi
shell: bash
# Next LTS: Use rit init --sendMetrics="yes" --addCommons="no" --runType="local"
- name: Add formula repository
run: |
if [ -z ${{ inputs.access_token }} ]; then
echo "PUBLIC 🔓 repository workflow detected"
if [[ "$(uname)" = "Linux" || "$(uname)" = "Darwin" ]]; then
rit add repo --provider=Github --name=public-repo --repoUrl=${{ inputs.rit_repo_url }} --priority=1
else
cd $GITHUB_WORKSPACE
./rit.exe add repo --provider=Github --name=public-repo --repoUrl=${{ inputs.rit_repo_url }} --priority=1
fi
else
echo "PRIVATE 🔐 repository workflow detected"
if [[ "$(uname)" = "Linux" || "$(uname)" = "Darwin" ]]; then
rit add repo --provider=Github --name=private-repo --repoUrl=${{ inputs.rit_repo_url }} --priority=1 --token=${{ inputs.access_token }}
else
cd $GITHUB_WORKSPACE
./rit.exe add repo --provider=Github --name=private-repo --repoUrl=${{ inputs.rit_repo_url }} --priority=1 --token=${{ inputs.access_token }}
fi
fi
shell: bash
- name: Run formula command
run: |
echo ⚙️ Running Ritchie Formula command:
cd $GITHUB_WORKSPACE
${{ inputs.rit_formula_command }}
shell: bash
branding:
icon: 'terminal'
color: 'gray-dark'