Deploy AWS #896
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: "Deploy AWS" | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "0 12 * * *" | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
jobs: | |
deploy: | |
name: "deploy" | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
env: | |
AWS_REGION: eu-south-1 | |
IAM_ROLE: arn:aws:iam::476761402556:role/GitHubActionDeploy | |
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 | |
with: | |
role-to-assume: ${{ env.IAM_ROLE }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Bundle | |
uses: ruby/setup-ruby@c4fe7bd15ddbfcd5e07e47bf2f2cae90581d6091 | |
with: | |
ruby-version: '2.7' | |
bundler-cache: true | |
- name: Build | |
run: bundle exec jekyll build --config _config.yml | |
env: | |
JEKYLL_ENV: production | |
- name: "Deploy to AWS S3" | |
env: | |
AWS_BUCKET: pagopa.gov.it | |
run: aws s3 sync ./_site/ s3://${{ env.AWS_BUCKET }} --acl public-read --delete | |
- name: "Create AWS Cloudfront Invalidation" | |
env: | |
AWS_CLOUDFRONT_ID: EQ48YU0B7VEBZ | |
run: aws cloudfront create-invalidation --distribution-id ${{ env.AWS_CLOUDFRONT_ID }} --paths "/*" |