-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (60 loc) · 2.06 KB
/
goldenimage-workflow.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
name: goldenimage Workflow
on:
workflow_call:
inputs:
APP:
required: true
type: string
REGION:
required: true
type: string
jobs:
Golden-Image:
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Debug Inputs
run: |
echo "APP: ${{ inputs.APP }}"
echo "REGION: ${{ inputs.REGION }}"
echo "WEBHOOK_URL: ${{ vars.WEBHOOK_URL }}"
# Check if the JSON file exists
- name: Check for goldenimage_result.json
id: check-file
run: |
if [[ -f "goldenimage_result.json" ]]; then
echo "File goldenimage_result.json exists."
else
echo "File goldenimage_result.json does not exist."
exit 1
fi
# Load parameters from JSON file
- name: Load parameters from goldenimage_result.json
id: load-parameters
run: |
JSON_CONTENT=$(jq '.' "goldenimage_result.json")
echo "$JSON_CONTENT"
TIMESTAMP=$(jq -r '.timestamp' <<< "$JSON_CONTENT")
ALL_AMIS=$(jq '.all_amis' <<< "$JSON_CONTENT")
APP=$(jq -r '.app' <<< "$JSON_CONTENT")
PROFILE=$(jq -r '.profile' <<< "$JSON_CONTENT")
REGION=$(jq -r '.region' <<< "$JSON_CONTENT")
VERSION=$(jq -r '.version' <<< "$JSON_CONTENT")
AMI=$(jq -r '.ami' <<< "$JSON_CONTENT")
# Use the loaded variables
- name: Use loaded parameters
run: |
echo "Using loaded variables:"
echo "AMI: $ami"
- name: Notify Discord for success
uses: sarisia/[email protected]
if: success() && vars.WEBHOOK_URL != ''
with:
nodetail: true
webhook: ${{ vars.WEBHOOK_URL }}
avatar_url: https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png
username: ${{ inputs.APP }}
content: Success goldenimage workflow
description: Workflow finished successfuly
title: New AMI was created on ${{ inputs.REGION }}
color: 5763719