From c7935885539508a3549d45385812ab0061d7e7f5 Mon Sep 17 00:00:00 2001 From: Abhinav R <76396917+Abhinav-ark@users.noreply.github.com> Date: Mon, 12 Aug 2024 01:48:45 +0530 Subject: [PATCH] Add github Actions CI/CD --- .github/workflows/ci-cd.yml | 36 ++++++++++++++++++++++++++++++++++++ util/constants.js | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci-cd.yml diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..c4ce3fd --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,36 @@ +name: CI/CD + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + + +jobs: + prepare: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Fetch Dockerfile + run: | + curl -O https://raw.githubusercontent.com/Abhinav-ark/placement_tracker_cicd/main/dockerfiles/placement_tracker_web/Dockerfile + + - name: Cache Dockerfile + uses: actions/cache@v3 + with: + path: ./Dockerfile + key: ${{ runner.os }}-dockerfile-${{ github.sha }} + + main-workflow: + needs: prepare + uses: Abhinav-ark/placement_tracker_cicd/.github/workflows/placement_tracker_web_deploy.yml@main + with: + branch: ${{ github.ref }} + secrets: + BACKEND_URL: ${{ secrets.BACKEND_URL }} + WIF_PROVIDER: ${{ secrets.WIF_PROVIDER }} + WIF_SERVICE_ACCOUNT: ${{ secrets.WIF_SERVICE_ACCOUNT }} diff --git a/util/constants.js b/util/constants.js index 879a63b..9de4775 100644 --- a/util/constants.js +++ b/util/constants.js @@ -1,4 +1,4 @@ -const BASE_URL = `${process.env.NEXT_PUBLIC_URL}/api`; +const BASE_URL = `${process.env.NEXT_PUBLIC_URL?process.env.NEXT_PUBLIC_URL:"http://localhost:5000"}/api`; export const LOGIN_URL = BASE_URL + "/login"; export const REGISTER_URL = BASE_URL + "/studentRegister";