Fix deploy workflow #43
This file contains hidden or 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: Build and deploy vapor.codes | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| name: Build and deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install latesst Swift | |
| uses: vapor/swiftly-action@bedb227456c5f495afbef80baebee17a8a02cef4 # v0.2.1 | |
| with: | |
| toolchain: latest | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Build site | |
| run: swift run | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1 | |
| with: | |
| role-to-assume: ${{ vars.OIDC_ROLE_ARN }} | |
| aws-region: ${{ vars.OIDC_ROLE_REGION }} | |
| - name: Deploy to AWS Cloudformation | |
| uses: aws-actions/aws-cloudformation-github-deploy@81e3b03d2266bcb76c4bcc37a7d71d9cb67838bb # v2.2.0 | |
| with: | |
| name: vapor-main-site-stack | |
| template: stack.yml | |
| parameter-overrides: >- | |
| DomainName=vapor.codes, | |
| S3BucketName=vapor-main-site, | |
| AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }} | |
| - name: Deploy Site to S3 | |
| run: | | |
| aws s3 sync ./Output 's3://vapor-main-site/' --no-progress --acl public-read --follow-symlinks --delete | |
| - name: Invalidate CloudFront | |
| run: | | |
| aws cloudfront create-invalidation --distribution-id '${{ secrets.DISTRIBUTION_ID }}' --paths '/*' |