From 8ed34e2178ea7a8ecdbc1946dfe20cc985ad73ee Mon Sep 17 00:00:00 2001 From: matan-h Date: Sun, 16 Jun 2024 15:32:08 +0300 Subject: [PATCH] add workflow --- .github/workflows/pages.yml | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..7a79950 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,66 @@ +# Workflow for building and deploying a React site to GitHub Pages +name: Deploy React site to Page + +on: + create: + tags: + - v* + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Build job + build: + name: build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Install dependencies + run: yarn install + + - name: Build React App + run: CI=false yarn build + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v1 + + - name: Upload artifact + # This will automatically upload an artifact from the 'build' directory + uses: actions/upload-pages-artifact@v1 + if: ${{ success() && github.ref == 'refs/heads/main' }} + with: + path: ./build/ + + # Deployment job + deploy: + name: deploy + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + if: ${{ github.ref == 'refs/heads/main' }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 + if: ${{ success() }}