Skip to content

Commit

Permalink
✨ snutt-webclient ci/cd (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
woohm402 authored May 16, 2024
1 parent 2b2bbdb commit 353de68
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/deploy-snutt-webclient-dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: deploy-dev
name: deploy-snutt-webclient-dev

on:
push:
tags:
- dev-*
- snutt-webclient-dev-*

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: dev
defaults:
run:
working-directory: ./apps/snutt-webclient

steps:
- name: Checkout
Expand All @@ -25,17 +29,17 @@ jobs:
run: |
yarn install
cp .env.dev .env.production
VITE_API_KEY=${{ secrets.API_KEY }} \
VITE_TRUFFLE_API_KEY=${{ secrets.TRUFFLE_API_KEY }} \
VITE_API_KEY=${{ secrets.BACKEND_API_KEY }} \
VITE_TRUFFLE_API_KEY=${{ secrets.SNUTT_WEBCLIENT_TRUFFLE_API_KEY }} \
VITE_GIT_SHA=$(git rev-parse HEAD) \
VITE_GIT_TAG=$(git describe --tags) \
yarn build
- name: Deploy to S3 and Invalidate Cloudfront
id: deploy-s3
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DEV }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_DEV }}
AWS_S3_BUCKET: ${{ secrets.SNUTT_WEBCLIENT_S3_BUCKET }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.SNUTT_WEBCLIENT_CLOUDFRONT_DISTRIBUTION_ID }}
run: |
aws s3 sync ./dist s3://$AWS_S3_BUCKET --delete
aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
17 changes: 10 additions & 7 deletions .github/workflows/deploy-snutt-webclient-prod.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: deploy-prod
name: deploy-snutt-webclient-prod

on:
push:
tags:
- prod-*
- snutt-webclient-prod-*

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: prod
defaults:
run:
working-directory: ./apps/snutt-webclient

steps:
- name: Checkout
Expand All @@ -25,18 +29,17 @@ jobs:
run: |
yarn install
cp .env.prod .env.production
VITE_API_KEY=${{ secrets.API_KEY }} \
VITE_TRUFFLE_API_KEY=${{ secrets.TRUFFLE_API_KEY }} \
VITE_API_KEY=${{ secrets.BACKEND_API_KEY }} \
VITE_TRUFFLE_API_KEY=${{ secrets.SNUTT_WEBCLIENT_TRUFFLE_API_KEY }} \
VITE_GIT_SHA=$(git rev-parse HEAD) \
VITE_GIT_TAG=$(git describe --tags) \
yarn build
- name: Deploy to S3 and Invalidate Cloudfront
id: deploy-s3
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_PROD }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_PROD }}
AWS_S3_BUCKET: ${{ secrets.SNUTT_WEBCLIENT_S3_BUCKET }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.SNUTT_WEBCLIENT_CLOUDFRONT_DISTRIBUTION_ID }}
run: |
aws s3 sync ./dist s3://$AWS_S3_BUCKET --delete
aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*"

0 comments on commit 353de68

Please sign in to comment.