This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yaml
65 lines (54 loc) · 2.02 KB
/
action.yaml
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
name: Manala CI for "elao.app" recipe
description: 'Provision & run commands inside a Manala CI environment with "elao.app" recipe'
author: Elao
branding:
icon: 'terminal'
color: 'orange'
inputs:
cmd:
description: 'Command to execute'
required: false
default: 'echo "Manala CI environment setup is done and ready to run your commands!"'
working-directory:
description: 'Working dir for the command, relative to your workspace dir'
required: false
docker-compose-file:
description: 'The docker-compose.yaml file used to start services'
required: false
default: '.manala/github/docker-compose.yaml'
runs:
using: 'composite'
steps:
- name: 'Escape cmd shell script by dumping into an executable file'
shell: bash
run: |
echo "${{ inputs.cmd }}" > ${{ inputs.working-directory || github.workspace }}/manala_ci_cmd.sh
chmod +x ${{ inputs.working-directory || github.workspace }}/manala_ci_cmd.sh
- name: 'Prepare'
shell: bash
run: |
docker_compose="docker-compose --file ${{ inputs.docker-compose-file }}"
echo "::group::Run services if not already up"
[ -z "$SSH_AUTH_SOCK"] && touch ~/ssh-agent
MANALA_CI_UID=$(id -u) MANALA_CI_GID=$(id -g) $docker_compose up --detach
docker ps --all
echo "::endgroup::"
- name: 'Execute cmd in the Manala CI environment'
id: execute-cmd
shell: bash
env:
# "The input device is not a TTY" (this env var)
# "ValueError: I/O operation on closed file." (-T)
# See https://github.com/docker/compose/issues/5696
COMPOSE_INTERACTIVE_NO_CLI: '1'
run: |
docker_compose="docker-compose --file ${{ inputs.docker-compose-file }}"
$docker_compose \
exec \
-T \
-w /srv/app/${{ inputs.working-directory }} \
manala_ci \
bash -c "./manala_ci_cmd.sh"
- name: 'Clean'
shell: bash
run: rm ${{ inputs.working-directory || github.workspace }}/manala_ci_cmd.sh