-
Notifications
You must be signed in to change notification settings - Fork 14
53 lines (48 loc) · 1.58 KB
/
publish.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
name: Publish
on:
workflow_dispatch:
inputs:
refToBuild:
description: 'Branch, tag or commit SHA1'
required: true
type: string
push:
branches: [master]
paths:
- "**/template.yaml"
- "**/template.yml"
jobs:
Publish:
name: publish
runs-on: ubuntu-latest
steps:
- name: Checkout when triggered by commit
uses: actions/checkout@v4
if: "${{ inputs.refToBuild == null }}"
with:
persist-credentials: false
fetch-depth: 0
- name: checkout when trigger manually
uses: actions/checkout@v4
if: "${{ inputs.refToBuild != null }}"
with:
ref: ${{ inputs.refToBuild }}
persist-credentials: false
fetch-depth: 0
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PUBLISH_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.PUBLISH_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
- name: Upload integrations files to s3
run: |
changed_files_string="${{ steps.changed-files.outputs.all_changed_files }}"
read -ra changed_files_array <<< "$changed_files_string"
for changed_template in "${changed_files_array[@]}"; do
if [[ $changed_template == */template.* ]]; then
aws s3 cp $changed_template s3://cgx-cloudformation-templates/${changed_template}
fi
done