bye. #42
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
actions: write | |
contents: read | |
id-token: write | |
jobs: | |
deploy: | |
name: π Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v3 | |
- name: β Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: π§ Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: | | |
- recursive: true | |
args: [--frozen-lockfile, --strict-peer-dependencies] | |
- name: π€ Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-duration-seconds: 900 | |
- name: π Deploy PR Preview | |
if: github.event_name == 'pull_request' | |
run: | | |
pnpm sst deploy --stage pr${{ github.event.number }} | |
env: | |
AWS_DOMAIN: ${{ secrets.AWS_DOMAIN }} | |
AWS_CERTIFICATE_ARN: ${{ secrets.AWS_CERTIFICATE_ARN }} | |
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_REPORT_URL: ${{ secrets.SENTRY_REPORT_URL }} | |
- name: π Deploy Production | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
pnpm sst deploy --stage prod | |
env: | |
AWS_DOMAIN: ${{ secrets.AWS_DOMAIN }} | |
AWS_CERTIFICATE_ARN: ${{ secrets.AWS_CERTIFICATE_ARN }} | |
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_REPORT_URL: ${{ secrets.SENTRY_REPORT_URL }} | |
- name: β»οΈ Purge Cloudfront cache | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/*" | |
- name: β»οΈ Purge Cloudflare cache | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: jakejarvis/cloudflare-purge-action@v0.3.0 | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
PURGE_URLS: '["https://${{ secrets.AWS_DOMAIN }}", "https://${{ secrets.AWS_DOMAIN }}/resume", "https://${{ secrets.AWS_DOMAIN }}/resume.pdf"]' |