Skip to content

Commit

Permalink
Merge pull request #9 from cosmology-tech/anmol/deploy-workflow
Browse files Browse the repository at this point in the history
gh-action: add inital deploy
  • Loading branch information
Anmol1696 authored May 12, 2024
2 parents 4a2bc2b + 843e79f commit b3fbdab
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Deploy Docs

on:
push:
branches:
- main
pull_request:
types: [opened, reopened]
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest

defaults:
run:
working-directory: .

steps:
- name: Checkout Repository 🛎️
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install Dependencies
run: yarn install

- name: Build Project
run: yarn export

- name: Deploy to S3
if: github.ref == 'refs/heads/main' || github.event_name != 'pull_request'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
run: yarn deploy

- name: Invalidate CloudFront
if: github.ref == 'refs/heads/main' || github.event_name != 'pull_request'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
run: yarn invalidate

0 comments on commit b3fbdab

Please sign in to comment.