Merge pull request #129 from SwiftServerConf/steven-tweak #77
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: Build and deploy sit | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build site | |
run: swift run | |
- name: Configure AWS credentials | |
id: cred | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: 'us-east-1' | |
- name: Deploy to AWS Cloudformation | |
id: clouddeploy | |
uses: aws-actions/[email protected] | |
with: | |
name: serversideswift-conf-site | |
template: deploy/stack.yaml | |
no-fail-on-empty-changeset: "1" | |
parameter-overrides: >- | |
AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }} | |
if: steps.cred.outcome == 'success' | |
- name: Deploy to S3 | |
id: s3deploy | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: 'www.serversideswift.info' | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' | |
SOURCE_DIR: 'Output' | |
if: steps.clouddeploy.outcome == 'success' | |
- name: Invalidate CloudFront | |
uses: awact/cloudfront-action@master | |
env: | |
SOURCE_PATH: '/*' | |
AWS_REGION: 'us-east-1' | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_ID }} |