From 14badc9766304e3287b30c9d960437e815522c80 Mon Sep 17 00:00:00 2001 From: Swapnil Sagar Date: Mon, 4 Nov 2024 18:19:44 +0530 Subject: [PATCH] Frontend build action --- .github/workflows/build-enclave.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/build-enclave.yml b/.github/workflows/build-enclave.yml index 1206b11..0a45392 100644 --- a/.github/workflows/build-enclave.yml +++ b/.github/workflows/build-enclave.yml @@ -4,9 +4,11 @@ on: push: branches: - master + - frontend-enclave pull_request: branches: - master + - frontend-enclave jobs: build-enclave: @@ -86,6 +88,7 @@ jobs: fi - name: Commit and push entrypoint.sh if created + run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" @@ -95,6 +98,36 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Build Frontend Code + run: | + if [ -d "webapp" ]; then + echo "webapp folder found. Starting frontend build..." + cd frontend + if [ "${{ inputs.package_manager || 'npm' }}" == "yarn" ]; then + yarn install + yarn build + else + npm install + npm run build + fi + else + echo "No frontend folder found, skipping frontend build." + fi + + - name: Commit and push frontend build + run: | + if [ -d "frontend/build" ]; then + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add frontend/build + git commit -m "Add frontend build files" || echo "No changes to commit" + git push + else + echo "No frontend build folder found, skipping commit and push." + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Build and Run Enclave run: | docker build -t enclave .