From 6d18e1da85802c2851377b3f1b19018886a9ab59 Mon Sep 17 00:00:00 2001 From: aayush60 Date: Mon, 25 Nov 2024 11:12:44 +0530 Subject: [PATCH] Update jekyll-gh-pages.yml --- .github/workflows/jekyll-gh-pages.yml | 46 ++++++++++++++++++--------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index e31d81c..76513b1 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -1,22 +1,16 @@ -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: Deploy Jekyll with GitHub Pages dependencies preinstalled + +name: Deploy React App to Pages on: - # Runs on pushes targeting the default branch push: - branches: ["main"] - - # Allows you to run this workflow manually from the Actions tab + branches: ["main"] # Replace "main" with your default branch if needed workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false @@ -28,15 +22,37 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Pages - uses: actions/configure-pages@v5 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 + + - name: Detect package manager + id: detect-package-manager + run: | + if [ -f "${{ github.workspace }}/yarn.lock" ]; then + echo "manager=yarn" >> $GITHUB_OUTPUT + echo "command=install" >> $GITHUB_OUTPUT + echo "runner=yarn" >> $GITHUB_OUTPUT + exit 0 + else + echo "No yarn.lock found. Exiting." + exit 1 + fi + + - name: Setup Node + uses: actions/setup-node@v4 with: - source: ./ - destination: ./_site + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + + - name: Install dependencies + run: yarn install + + - name: Build React App + run: yarn build + - name: Upload artifact uses: actions/upload-pages-artifact@v3 + with: + path: + ./build # Update this path if your output folder is different # Deployment job deploy: