From 6fa49d165202cdb6e6db09e7a6da236dfcebf15d Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 27 Oct 2023 14:12:20 +0200 Subject: [PATCH 1/4] Added gh workflow --- .github/workflows/build-deploy.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/build-deploy.yml diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 0000000..e69de29 From f012ee8309f60f0004fab869f53f13bec14aaa0f Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 27 Oct 2023 14:24:05 +0200 Subject: [PATCH 2/4] Updated workflow and added homepage property --- .github/workflows/build-deploy.yml | 56 ++++++++++++++++++++++++++++++ my-react-app/package.json | 1 + 2 files changed, 57 insertions(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index e69de29..44d50f5 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,56 @@ +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: npm run build + + - name: Uploading production-ready build files + uses: actions/upload-artifact@v2 + with: + name: production-files + path: ./build + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - name: Downloading artifact + uses: actions/download-artifact@v2 + with: + name: production-files + path: ./build + + - name: Deploying to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./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", From f5952e1c84f327bafb13433a9bc1bb42a4b50f5e Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 27 Oct 2023 14:29:10 +0200 Subject: [PATCH 3/4] workfloww --- .github/workflows/build-deploy.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 44d50f5..f2619b5 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -28,13 +28,15 @@ jobs: npm ci - name: Building project - run: npm run build + run: | + cd my-react-app/ + npm run build - name: Uploading production-ready build files uses: actions/upload-artifact@v2 with: name: production-files - path: ./build + path: my-react-app/build deploy: name: Deploy @@ -47,10 +49,10 @@ jobs: uses: actions/download-artifact@v2 with: name: production-files - path: ./build + path: my-react-app/build - name: Deploying to gh-pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build \ No newline at end of file + publish_dir: my-react-app/build \ No newline at end of file From d3871f90ef8288aae57902cd940ee4726fa13918 Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 27 Oct 2023 14:38:02 +0200 Subject: [PATCH 4/4] workflow2 --- .github/workflows/build-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index f2619b5..4f39e11 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -45,6 +45,8 @@ jobs: if: github.ref == 'refs/heads/main' steps: + - name: Checkout code + uses: actions/checkout@v4 - name: Downloading artifact uses: actions/download-artifact@v2 with: