Sponsors update #13
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 the website | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: NPM Install | |
run: npm install | |
- name: Build site | |
run: npm run build | |
- name: Configure AWS credentials | |
id: cred | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_SECRET }} | |
aws-region: 'eu-west-2' | |
- name: Deploy to AWS Cloudformation | |
if: steps.cred.outcome == 'success' | |
id: clouddeploy | |
timeout-minutes: 30 | |
uses: aws-actions/[email protected] | |
with: | |
name: vapor-main-site-stack | |
template: stack.yml | |
no-fail-on-empty-changeset: "1" | |
parameter-overrides: >- | |
DomainName=vapor.codes, | |
S3BucketName=vapor-main-site, | |
AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }} | |
- name: Deploy to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: 'vapor-main-site' | |
AWS_ACCESS_KEY_ID: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_SECRET }} | |
AWS_REGION: 'eu-west-2' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'dist' # optional: defaults to entire repository | |
- name: Invalidate CloudFront | |
uses: awact/cloudfront-action@master | |
env: | |
SOURCE_PATH: '/*' | |
AWS_REGION: 'eu-west-2' | |
AWS_ACCESS_KEY_ID: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SITE_DEPLOYER_ACCESS_KEY_SECRET }} | |
DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_ID }} |