From a9fda6f37587c92a4d831b2bb35c726c5e45ef4d Mon Sep 17 00:00:00 2001 From: Nischal Shrestha Date: Wed, 3 Jul 2024 14:29:47 +0545 Subject: [PATCH 1/3] ci: frotnend build workflow on PR and push --- .github/workflows/test_frontend.yml | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/test_frontend.yml diff --git a/.github/workflows/test_frontend.yml b/.github/workflows/test_frontend.yml new file mode 100644 index 00000000..27519f9b --- /dev/null +++ b/.github/workflows/test_frontend.yml @@ -0,0 +1,61 @@ +name: Test Frontend Static Build + +on: + pull_request: + branches: + - master + - develop + - staging + paths: + - src/frontend/** + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + build: + name: Build JavaScript assets + runs-on: ubuntu-latest + environment: + name: ${{ github.ref_name }} + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + ref: ${{ github.ref_name }} + + - name: Use Node.js 19.x + uses: actions/setup-node@v1 + with: + node-version: 19.x + + - name: Install yarn + working-directory: ./src/frontend/ + run: npm install -g yarn + + - name: Cache node_modules + uses: actions/cache@v2 + with: + path: ./src/frontend/node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Write Environment Variables + id: write_env + working-directory: ./src/frontend/ + run: | + echo ${{ vars.FRONTEND_ENV_VARS }} > .env + + - name: Install dependencies + working-directory: ./src/frontend/ + run: yarn + + - name: Generate build + working-directory: ./src/frontend/ + run: | + yarn build From e16c1ba97b5f49c3114c41393c61411d2cd4eb45 Mon Sep 17 00:00:00 2001 From: Nischal Shrestha Date: Wed, 3 Jul 2024 14:31:38 +0545 Subject: [PATCH 2/3] fix: precommit on main branch --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 40b9f6b3..a95e6572 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,7 +3,7 @@ name: Precommit Code Check on: pull_request: branches: - - master + - main - develop - staging push: From d9dc1c592c2430ef48aa5e1086ca869f72b49fd7 Mon Sep 17 00:00:00 2001 From: Nischal Shrestha Date: Wed, 3 Jul 2024 14:35:09 +0545 Subject: [PATCH 3/3] ci: frotnend build workflow on PR and push --- .github/workflows/test_frontend.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_frontend.yml b/.github/workflows/test_frontend.yml index 27519f9b..a0f30e71 100644 --- a/.github/workflows/test_frontend.yml +++ b/.github/workflows/test_frontend.yml @@ -3,11 +3,11 @@ name: Test Frontend Static Build on: pull_request: branches: - - master + - main - develop - staging paths: - - src/frontend/** + - src/frontend/** workflow_dispatch: permissions: