From 63b0edda8a6d40f63ef83d3d12b8c308703ec51b Mon Sep 17 00:00:00 2001 From: "Leon W." Date: Tue, 14 May 2024 01:04:37 +0200 Subject: [PATCH] fix gh pages deploy --- .github/workflows/gh-pages.yml | 44 ++++++++++++++++++++++++++-------- package.json | 3 ++- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index c3f9c6e..f74c22e 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,17 +1,41 @@ -name: React app deployment +name: Deploy React App to Github Pages on: push: - branches: - - main + branches: ["main"] -jobs: - build: + 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 +jobs: + deploy: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Deploy react app to github pages - uses: tanwanimohit/deploy-react-to-ghpages@v1.0.1 + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '21.x' + - run: npm ci + - run: npm run build + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: 'build' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/package.json b/package.json index 0f6bb34..c5967a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "the-game", "version": "0.1.0", + "homepage": "https://leon-w.github.io/the-game", "private": true, "dependencies": { "@types/node": "^16.18.97", @@ -38,4 +39,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file