Skip to content

Commit

Permalink
chore: Update AWS credentials configuration and deploy script for kno…
Browse files Browse the repository at this point in the history
…wx project
  • Loading branch information
Diegogtz03 committed May 16, 2024
1 parent 8cdc99e commit 597c628
Showing 1 changed file with 57 additions and 59 deletions.
116 changes: 57 additions & 59 deletions .github/workflows/frontend_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,63 @@ on:
- H010-UserHistory

jobs:
# test:
# name: "Frontend Tests"
# environment: prod
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Install Node
# uses: actions/setup-node@v4
# with:
# node-version: '20'
# working-directory: knowx

# - name: Install Dependencies
# run: npm install
# working-directory: knowx

# - name: Make envfile
# uses: SpicyPizza/[email protected]
# with:
# envkey_API_ROOT_ROUTE: ${{ secrets.API_ROOT_ROUTE }}
# envkey_DB_URL: ${{ secrets.DB_URL }}
# envkey_NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
# envkey_NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
# envkey_GITHUB_ID: ${{ secrets.NEXTAUTH_GITHUB_ID }}
# envkey_GITHUB_SECRET: ${{ secrets.NEXTAUTH_GITHUB_SECRET }}
# envkey_GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
# envkey_GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
# envkey_EMAIL_SERVER_HOST: ${{ secrets.EMAIL_SERVER_HOST }}
# envkey_EMAIL_SERVER_PORT: ${{ secrets.EMAIL_SERVER_PORT }}
# envkey_EMAIL_SERVER_USER: ${{ secrets.EMAIL_SERVER_USER }}
# envkey_EMAIL_SERVER_PASSWORD: ${{ secrets.EMAIL_SERVER_PASSWORD }}
# envkey_EMAIL_FROM: ${{ secrets.EMAIL_FROM }}
# envkey_SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
# directory: knowx

# - name: Run Tests
# uses: cypress-io/github-action@v6
# with:
# build: npm run build
# start: npm start
# working-directory: knowx

# - name: Send Deploy Failure Message
# if: failure()
# run: curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=💥 Front Testing Failed"

# - name: Send Deploy Success Message
# if: success()
# run: |
# curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=🧪 Front Testing Successful"
test:
name: "Frontend Tests"
environment: prod
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '20'
working-directory: knowx

- name: Install Dependencies
run: npm install
working-directory: knowx

- name: Make envfile
uses: SpicyPizza/[email protected]
with:
envkey_API_ROOT_ROUTE: ${{ secrets.API_ROOT_ROUTE }}
envkey_DB_URL: ${{ secrets.DB_URL }}
envkey_NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
envkey_NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
envkey_GITHUB_ID: ${{ secrets.NEXTAUTH_GITHUB_ID }}
envkey_GITHUB_SECRET: ${{ secrets.NEXTAUTH_GITHUB_SECRET }}
envkey_GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
envkey_GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
envkey_EMAIL_SERVER_HOST: ${{ secrets.EMAIL_SERVER_HOST }}
envkey_EMAIL_SERVER_PORT: ${{ secrets.EMAIL_SERVER_PORT }}
envkey_EMAIL_SERVER_USER: ${{ secrets.EMAIL_SERVER_USER }}
envkey_EMAIL_SERVER_PASSWORD: ${{ secrets.EMAIL_SERVER_PASSWORD }}
envkey_EMAIL_FROM: ${{ secrets.EMAIL_FROM }}
envkey_SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
directory: knowx

- name: Run Tests
uses: cypress-io/github-action@v6
with:
build: npm run build
start: npm start
working-directory: knowx

- name: Send Deploy Failure Message
if: failure()
run: curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=💥 Front Testing Failed"

- name: Send Deploy Success Message
if: success()
run: |
curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=🧪 Front Testing Successful"
dev_deploy:
# needs: test
needs: test
name: "Deploy to AWS - DEV"
environment: dev
runs-on: ubuntu-latest
Expand All @@ -75,11 +75,9 @@ jobs:
- name: Cofigure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 1200
aws-region: us-east-1
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Verify AWS Credentials
run: aws sts get-caller-identity
Expand Down Expand Up @@ -124,8 +122,8 @@ jobs:
EMAIL_FROM: ${{ secrets.EMAIL_FROM }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}

- name: Deploy
id: deploy
- name: Npm Install
id: npm_install
run: |
npm install
working-directory: knowx
Expand Down

0 comments on commit 597c628

Please sign in to comment.