Set Feed RSS Content Type (#91) #103
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 blog.vapor.codes | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build site | |
run: swift run | |
- name: Configure AWS credentials | |
id: cred | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
aws-region: 'eu-west-2' | |
- name: Deploy to AWS Cloudformation | |
id: clouddeploy | |
uses: aws-actions/aws-cloudformation-github-deploy@v1 | |
with: | |
name: vapor-blog-stack | |
template: stack.yaml | |
no-fail-on-empty-changeset: "1" | |
parameter-overrides: >- | |
DomainName=blog.vapor.codes, | |
S3BucketName=vapor-blog-site, | |
AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }} | |
if: steps.cred.outcome == 'success' | |
- name: Deploy Main Site to S3 | |
id: s3deploy | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete --exclude 'feed.rss' | |
env: | |
AWS_S3_BUCKET: 'vapor-blog-site' | |
AWS_ACCESS_KEY_ID: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-2' | |
SOURCE_DIR: 'Output' | |
if: steps.clouddeploy.outcome == 'success' | |
# This is done as a separate step to ensure the RSS feed is served with the correct content type | |
- name: Deploy RSS Feed to S3 | |
id: s3deploy-rss | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'feed.rss' --content-type 'application/rss+xml' | |
env: | |
AWS_S3_BUCKET: 'vapor-blog-site' | |
AWS_ACCESS_KEY_ID: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-2' | |
SOURCE_DIR: 'Output' | |
if: steps.clouddeploy.outcome == 'success' | |
- name: Invalidate CloudFront | |
uses: awact/cloudfront-action@master | |
env: | |
SOURCE_PATH: '/*' | |
AWS_REGION: 'eu-west-2' | |
AWS_ACCESS_KEY_ID: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }} | |
DISTRIBUTION_ID: ${{ secrets.VAPOR_BLOG_DISTRIBUTION_ID }} |