-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (87 loc) · 2.79 KB
/
main.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: master
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
id-token: write
concurrency:
cancel-in-progress: false
group: "${{ github.workflow }}-${{ github.ref }}"
env:
AWS_REGION: us-east-2
jobs:
changes:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
outputs:
ci: "${{ steps.filter.outputs.ci }}"
aws-backup-elastio-integration: "${{ steps.filter.outputs.aws-backup-elastio-integration }}"
elastio-s3-changelog: "${{ steps.filter.outputs.elastio-s3-changelog }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if files were modified
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
ci:
- '.github/workflows/**'
aws-backup-elastio-integration:
- 'aws-backup-elastio-integration/**'
elastio-s3-changelog:
- 'elastio-s3-changelog/**'
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@v1.20.10
upload-aws-backup-elastio-integration:
runs-on: ubuntu-latest
needs: changes
if: >-
github.event_name != 'pull_request' && (
needs.changes.outputs.aws-backup-elastio-integration == 'true' ||
needs.changes.outputs.ci == 'true'
)
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: "aws-actions/configure-aws-credentials@v4"
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: "arn:aws:iam::537513441174:role/Github-Actions-Contrib-OIDC-Role"
special-characters-workaround: 'true'
- name: Upload lambda and cfn to bucket
env:
NAME: aws-backup-elastio-integration
CFN_NAME: Elastio_stack.yaml
S3_BUCKET: "elastio-artifacts-us-east-2"
S3_KEY: "contrib"
run: |
aws s3 cp ${NAME}/${CFN_NAME} s3://${S3_BUCKET}/${S3_KEY}/${CFN_NAME}
cd ${NAME}
zip ${NAME}.zip lambda_handler.py
aws s3 cp ${NAME}.zip s3://${S3_BUCKET}/${S3_KEY}/${NAME}.zip
upload-elastio-s3-changelog:
runs-on: ubuntu-latest
needs: changes
if: >-
github.event_name != 'pull_request' && (
needs.changes.outputs.elastio-s3-changelog == 'true' ||
needs.changes.outputs.ci == 'true'
)
env:
S3_BUCKET: elastio-prod-artifacts-us-east-2
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ vars.aws_elastio_prod_artifacts_contrib_role_arn }}
- run: ./elastio-s3-changelog/upload.sh