Skip to content

Commit

Permalink
github actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Facundo De Lorenzo committed May 16, 2024
1 parent 7af5fc3 commit 6c324c1
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Front

on:
push:
paths:
- "packages/api/**"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v4
with:
node-version: ${{matrix.node-version}}
cache: "pnpm"

- name: Install dependencies
run: pnpm i --filter api --config.dedupe-peer-dependents=false

- name: Build application
working-directory: ./packages/api
run: pnpm build

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Build
working-directory: ./packages/api
run: sam build

- name: SAM Deploy
working-directory: ./packages/api
run:
yes | sam deploy --stack-name wakeup-fullstack-challenge-api --capabilities CAPABILITY_IAM

39 changes: 39 additions & 0 deletions .github/workflows/front.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Front

on:
push:
paths:
- "packages/front/**"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm --filter front install

- name: Build
run: pnpm build:front
env:
CI: ""

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} #poner en secrets
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} #poner en secrets
aws-region: us-east-1

- name: Deploy to s3
working-directory: ./packages/front
run: |
aws s3 sync build s3://wakeup-fullstack-challenge/
aws cloudfront create-invalidation --distribution-id E1M5KJF9PNWSUC --paths "/*"

0 comments on commit 6c324c1

Please sign in to comment.