Skip to content

Commit

Permalink
test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
SAINIAbhishek committed Oct 3, 2024
1 parent 28108ee commit e0042d7
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 40 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build Workflow

on:
workflow_call:
inputs:
environment:
description: 'development || production'
default: development
type: string
working-directory:
description: 'Directory where the build command will run'
type: string
default: './'

jobs:
build:
runs-on: ubuntu-latest
environment: ${{ inputs['environment'] }}
steps:
- name: Checkout Code
uses: actions/checkout@v3

# Restore Modules cache
- name: Restore Modules Cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-auth-${{ hashFiles('package-lock.json') }}

- name: Build for ${{ inputs['environment'] }}
run: npm run build
working-directory: ${{ inputs['working-directory'] }}
env:
PORT: ${{ vars.API_PORT }}
MONGO_URI: ${{ vars.MONGO_URI }}
MONGO_DB_HOST: ${{ vars.MONGO_DB_HOST }}
TOKEN_ISSUER: ${{ vars.TOKEN_ISSUER}}
TOKEN_AUDIENCE: ${{ vars.TOKEN_AUDIENCE}}
CORS_URL: ${{ vars.CORS_URL}}
FRONTEND_RESET_URL: ${{ vars.FRONTEND_RESET_URL}}
API_VERSION: ${{ vars.API_VERSION}}
ACCESS_TOKEN_SECRET_KEY: ${{ secrets.ACCESS_TOKEN_SECRET_KEY}}
MAILTRAP_TESTING_USERNAME: ${{ secrets.MAILTRAP_TESTING_USERNAME}}
MAILTRAP_TESTING_PASSWORD: ${{ secrets.MAILTRAP_TESTING_PASSWORD}}
MAILTRAP_USERNAME: ${{ secrets.MAILTRAP_USERNAME}}
MAILTRAP_PASSWORD: ${{ secrets.MAILTRAP_PASSWORD}}
MAILTRAP_TESTING_HOST: ${{ vars.MAILTRAP_TESTING_HOST}}
REFRESH_TOKEN_SECRET_KEY: ${{ secrets.REFRESH_TOKEN_SECRET_KEY}}
MAILTRAP_EMAIL_ENV: ${{ vars.MAILTRAP_EMAIL_ENV}}

- name: Save ${{ inputs['environment'] }} Build Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs['environment'] }}-build
path: build
40 changes: 2 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,42 +72,6 @@ jobs:
working-directory: './'

# Step: Build the project
build:
dev:
needs: [lint, format, dependencies-check]
runs-on: ubuntu-latest
environment: development
steps:
- name: Checkout Code
uses: actions/checkout@v3

# Restore Modules cache
- name: Restore Modules Cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-auth-${{ hashFiles('package-lock.json') }}

- name: Build for development
run: npm run build
working-directory: ./
env:
PORT: ${{ vars.API_PORT }}
MONGO_URI: ${{ vars.MONGO_URI }}
MONGO_DB_HOST: ${{ vars.MONGO_DB_HOST }}
TOKEN_ISSUER: ${{ vars.TOKEN_ISSUER}}
TOKEN_AUDIENCE: ${{ vars.TOKEN_AUDIENCE}}
CORS_URL: ${{ vars.CORS_URL}}
FRONTEND_RESET_URL: ${{ vars.FRONTEND_RESET_URL}}
API_VERSION: ${{ vars.API_VERSION}}
ACCESS_TOKEN_SECRET_KEY: ${{ secrets.ACCESS_TOKEN_SECRET_KEY}}
MAILTRAP_TESTING_USERNAME: ${{ secrets.MAILTRAP_TESTING_USERNAME}}
MAILTRAP_TESTING_PASSWORD: ${{ secrets.MAILTRAP_TESTING_PASSWORD}}
MAILTRAP_TESTING_HOST: ${{ vars.MAILTRAP_TESTING_HOST}}
REFRESH_TOKEN_SECRET_KEY: ${{ secrets.REFRESH_TOKEN_SECRET_KEY}}
MAILTRAP_EMAIL_ENV: ${{ vars.MAILTRAP_EMAIL_ENV}}

- name: Save Devlopment Build Artifacts
uses: actions/upload-artifact@v4
with:
name: dev-build
path: build
uses: ./.github/workflows/build.yml
4 changes: 2 additions & 2 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Node Auth Application Pipeline
name: Node Auth Application Production Pipeline

# Trigger the workflow
on:
push:
branches:
- '**'
- 'main'

jobs:
build:
Expand Down

0 comments on commit e0042d7

Please sign in to comment.