From bf8a9115a125bdfc69c605ead2e64c4c21fedeac Mon Sep 17 00:00:00 2001 From: Wise Date: Sat, 28 Dec 2024 17:29:10 +0000 Subject: [PATCH] Create deploy.yml --- .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..143442a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: Deploy React App + +on: + push: + branches: + - master + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + + - name: Install dependencies + run: npm install + + - name: Configure React homepage + run: | + echo "Configuring homepage in package.json" + REPO_NAME=${{ github.event.repository.name }} + USER_NAME=${{ github.event.repository.owner.login }} + jq ".homepage=\"https://$USER_NAME.github.io/$REPO_NAME\"" package.json > tmp.json + mv tmp.json package.json + + - name: Build project + run: npm run build + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4