-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
100 lines (88 loc) · 3.11 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
name: 'Conveyor'
description: 'Download, install and run Conveyor'
inputs:
command:
description: 'Which conveyor command to execute. For example, "make copied-site"'
type: string
required: false
default: 'make site'
signing_key:
description: 'The root signing key for your application, corresponding to config key "app.signing-key"'
type: string
required: true
agree_to_license:
description: >
The version of the [Conveyor license](https://www.hydraulic.dev/eula.html) you agree to.
You must agree with the license to run Conveyor. Current version is 1.
type: string
required: true
extra_flags:
description: Additional flags to pass to Conveyor.
type: string
required: false
cache_key:
description: Optional cache key used to store the Conveyor installation and task cache.
type: string
required: false
default: 'conveyor'
cache_path:
description: Optional path to the location where Conveyor will be installed and keep the task cache.
type: string
required: false
default: '.conveyor'
conveyor_version:
description: Version of Conveyor to run.
type: string
required: false
default: '11.1'
runs:
using: composite
steps:
# Workaround to https://github.com/actions/runner/issues/1070
- name: Check inputs
shell: bash
run: |
if [ -z "${{ inputs.signing_key }}" ]; then
echo "Missing required input: signing_key"
exit 1
fi
if [ -z "${{ inputs.agree_to_license }}" ]; then
echo "Missing required input: agree_to_license"
exit 1
fi
if [ "${{ runner.os }}" != "Linux" ]; then
echo "This action must be run in a Linux runner"
exit 1
fi
- name: Check cache
id: check_cache
shell: bash
run: |
[ -d "${{ inputs.cache_path }}" ] && FOUND=true || FOUND=false
echo "found=$FOUND" >> "$GITHUB_OUTPUT"
- name: Load cache
if: ${{ steps.check_cache.outputs.found != 'true' }}
uses: actions/cache@v3
with:
key: ${{ inputs.cache_key }}-${{github.run_id }}
path: ${{ inputs.cache_path }}
restore-keys: ${{ inputs.cache_key }}
- name: Download Conveyor
shell: bash
run: |
if [ ! -d "${{ inputs.cache_path }}/install/conveyor-${{ inputs.conveyor_version }}" ]; then
wget https://downloads.hydraulic.dev/conveyor/conveyor-${{ inputs.conveyor_version }}-linux-amd64.tar.gz
mkdir -p ${{ inputs.cache_path }}/install
tar xzvf conveyor-${{ inputs.conveyor_version }}-linux-amd64.tar.gz -C ${{ inputs.cache_path }}/install
fi
- name: Run Conveyor
env:
SIGNING_KEY: ${{ inputs.signing_key }}
CONVEYOR_AGREE_TO_LICENSE: ${{ inputs.agree_to_license }}
shell: bash
run: |
PATH="$PATH:${{ inputs.cache_path }}/install/conveyor-${{ inputs.conveyor_version }}/bin"
conveyor --cache-dir="${{ inputs.cache_path }}/cache" "-Kapp.signing-key=$SIGNING_KEY" ${{ inputs.extra_flags }} ${{ inputs.command }}
branding:
icon: 'package'
color: 'blue'