Update README.md #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AWS CF CI/CD | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'aws/cloudformation/**' | |
- '.github/workflows/aws-cf-workflow.yaml' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'aws/cloudformation/**' | |
- '.github/workflows/aws-cf-workflow.yaml' | |
jobs: | |
lint-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install cfn-lint | |
run: pip install cfn-lint | |
- name: Lint CloudFormation Templates | |
run: find aws/cloudformation/templates -type f -name "*.yaml" -exec cfn-lint {} + | |
- name: Set up AWS CLI | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.SE_CF_AWS_ROLE }} | |
aws-region: eu-west-3 | |
- name: Deploy to S3 | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
S3_BUCKET="dev-${{ vars.SE_CF_S3_BUCKET }}" | |
else | |
S3_BUCKET=${{ vars.SE_CF_S3_BUCKET }} | |
fi | |
aws s3 sync aws/cloudformation/templates s3://$S3_BUCKET --exclude ".git/*" --delete |