generated from cloudposse-github-actions/composite-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yml
59 lines (56 loc) · 1.72 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
name: 'Spacelift stack deploy'
description: 'Synchronously deploy Spacelift stack'
author: hello@cloudposse.com
branding:
icon: 'link-2'
color: 'white'
inputs:
organization:
required: true
description: "Organization name"
stack:
required: true
description: "Stack name"
autodeploy:
required: false
description: "If true, automatically deploy the stack without manual confirmation"
default: "false"
api_key_id:
required: true
description: "API Key ID"
api_key_secret:
required: true
description: "API Key Secret"
github_token:
required: true
description: "GitHub Token (Required to install Spacelift CLI)"
outputs:
outputs:
description: "Stack outputs"
value: "${{ steps.spacelift.outputs.result }}"
runs:
using: "composite"
steps:
- name: Install spacectl
uses: spacelift-io/setup-spacectl@main
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
- name: 'Setup jq'
uses: dcarbone/install-jq-action@v1.0.1
- id: spacelift
name: Spacelift deploy
shell: bash
env:
SPACELIFT_API_KEY_ENDPOINT: https://${{ inputs.organization }}.app.spacelift.io
SPACELIFT_API_KEY_ID: ${{ inputs.api_key_id }}
SPACELIFT_API_KEY_SECRET: ${{ inputs.api_key_secret }}
run: |
if [ "${{ inputs.autodeploy }}" = "true" ]; then
spacectl stack deploy --id=${{ inputs.stack }} --tail --auto-confirm
else
spacectl stack deploy --id=${{ inputs.stack }} --tail
fi
RESULT=$(spacectl stack outputs --id=${{ inputs.stack }} --no-color --output json | \
jq 'map({id: .id, value: (.value | fromjson) })' -c -e -M
)
echo "result=${RESULT}" >> $GITHUB_OUTPUT