-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaction.yml
44 lines (39 loc) · 1.43 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
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: Docker Compose Setup
description: Install Docker Compose
branding:
icon: anchor
color: blue
inputs:
version:
description: 'Compose release (example: v2.2.0)'
required: false
default: latest
legacy:
description: 'Also install as legacy "docker-compose"'
required: false
default: true
runs:
using: 'composite'
steps:
- name: install
shell: bash
run: |
set -x
set -e
arch="$(uname)-$(uname -m)"
flavor=$(echo $arch | tr '[:upper:]' '[:lower:]' )
DOWNLOAD_URL="https://github.com/docker/compose/releases/download/${{ inputs.version }}/docker-compose-${flavor}"
if [[ "${{ inputs.version }}" == "latest" ]]; then
DOWNLOAD_URL=$(curl -fL https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[] | select(.name == "docker-compose-linux-x86_64") | .browser_download_url')
fi
echo "Download Compose ${{ inputs.version }} for ${flavor} from ${DOWNLOAD_URL}"
mkdir -p ~/.docker/cli-plugins/
curl -fsSL "$DOWNLOAD_URL" -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
- name: alias docker-compose
if: ${{ inputs.legacy }}
shell: bash
run: |
mkdir -p ~/.local/bin/
ln -s ~/.docker/cli-plugins/docker-compose ~/.local/bin/docker-compose