diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 0000000..4f39e11 --- /dev/null +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,60 @@ +name: Build & deploy + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Installing Node.js + uses: actions/setup-node@v3 + with: + node-version: 19.x + + - name: Installing NPM packages + run: | + cd my-react-app/ + npm ci + + - name: Building project + run: | + cd my-react-app/ + npm run build + + - name: Uploading production-ready build files + uses: actions/upload-artifact@v2 + with: + name: production-files + path: my-react-app/build + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Downloading artifact + uses: actions/download-artifact@v2 + with: + name: production-files + path: my-react-app/build + + - name: Deploying to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: my-react-app/build \ No newline at end of file diff --git a/my-react-app/package.json b/my-react-app/package.json index 08b2102..a041dfb 100644 --- a/my-react-app/package.json +++ b/my-react-app/package.json @@ -1,6 +1,7 @@ { "name": "my-react-app", "version": "0.1.0", + "homepage": "https://thomass1412.github.io/P3-BM-dashboard/", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.17.0",