-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CICD pipeline for automated deployment
- Loading branch information
Showing
3 changed files
with
102 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: CI/CD ⚙️ | ||
|
||
on: | ||
push: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: 'Environment to run deploy' | ||
type: environment | ||
required: true | ||
force: | ||
description: 'Deploy even if tests fail' | ||
type: boolean | ||
required: false | ||
default: false | ||
|
||
jobs: | ||
test: | ||
name: Test 🧪 | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.pull_request.head.sha || github.sha}} | ||
|
||
- name: Docker API Build | ||
run: docker build -t test -f Dockerfile-test . | ||
|
||
- name: Docker API Test Run | ||
run: docker run -e CHECK_CODEGEN=true test | ||
|
||
deploy-to-dev: | ||
name: Deploy to Development 🚧 | ||
needs: test | ||
if: github.event_name == 'push' && github.ref_name == 'main' | ||
concurrency: dev | ||
uses: './.github/workflows/deploy.yml' | ||
with: | ||
environment: dev | ||
secrets: inherit | ||
|
||
deploy-to-prod: | ||
name: Deploy to Production 🌟 | ||
needs: test | ||
if: github.event_name == 'release' | ||
concurrency: prod | ||
uses: './.github/workflows/deploy.yml' | ||
with: | ||
environment: prod | ||
secrets: inherit | ||
|
||
manual-deployment: | ||
name: Manual Deployment ‼️ | ||
needs: test | ||
if: github.event_name == 'workflow_dispatch' && (success() || inputs.force == true) | ||
concurrency: ${{ inputs.environment }} | ||
uses: './.github/workflows/deploy.yml' | ||
with: | ||
environment: ${{ inputs.environment }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# A reusable workflow that deploys the contents of a repository to a target environment. | ||
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
deploy: | ||
name: 🚀 | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install --no-save | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ vars.DEPLOYMENT_ROLE_ARN }} | ||
role-session-name: ${{ github.actor }} | ||
aws-region: ${{ vars.AWS_REGION || 'us-west-2' }} | ||
|
||
- name: Deploy | ||
run: npm run deploy-${{ inputs.environment }} |
This file was deleted.
Oops, something went wrong.