Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci/cd pipeline #1

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CD pipeline

on:
pull_request:
branches:
- main
types: [closed]

jobs:
build:
if: github.event.pull_request.merged == true

runs-on: ubuntu-latest

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

steps:
- name: Notify Trigger
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event on branch ${{ github.ref }}."

- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2

- name: Cache Dependencies
uses: actions/cache@v2
id: backend-npm-cache
with:
path: "node_modules"
key: client-npm-${{ hashFiles('package.json') }}

- name: Install Dependencies
run: npm install
if: steps.backend-npm-cache.outputs.cache-hit != 'true'

- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Build AWS CDK stack
run: npm run build

- name: Deploy AWS CDK stack
run: npx cdk deploy --ci --require-approval never

- name: Display Job Status
run: echo "🍏 This job's status is ${{ job.status }}."
61 changes: 61 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI pipeline

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

steps:
- name: Notify Trigger
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event on branch ${{ github.ref }}."

- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2

- name: Cache Dependencies
uses: actions/cache@v2
id: backend-npm-cache
with:
path: "node_modules"
key: client-npm-${{ hashFiles('package.json') }}

- name: Install Dependencies
run: npm install
if: steps.backend-npm-cache.outputs.cache-hit != 'true'

- name: Run Linter
run: npm run lint

- name: Run Typecheck
run: npm run typecheck

- name: Run Test
run: npm run test

- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Build AWS CDK stack
run: npm run build

- name: Diff AWS CDK stack
run: npx cdk diff --ci --require-approval never

- name: Display Job Status
run: echo "🍏 This job's status is ${{ job.status }}."
Loading