From 85c177be0091c1bb7da0604071a9242c3948bf6b Mon Sep 17 00:00:00 2001 From: James Bonwick Date: Thu, 25 Apr 2024 15:30:19 +0100 Subject: [PATCH 1/6] Testing --- github_site/index.html | 2 ++ github_site/test.js | 1 + 2 files changed, 3 insertions(+) create mode 100644 github_site/index.html create mode 100644 github_site/test.js diff --git a/github_site/index.html b/github_site/index.html new file mode 100644 index 0000000..87d7b00 --- /dev/null +++ b/github_site/index.html @@ -0,0 +1,2 @@ +

Hello World!

+ \ No newline at end of file diff --git a/github_site/test.js b/github_site/test.js new file mode 100644 index 0000000..0781663 --- /dev/null +++ b/github_site/test.js @@ -0,0 +1 @@ +console.log("hi") \ No newline at end of file From 2b62d349c9d192ecfed34ecb3a495a3d88b544c0 Mon Sep 17 00:00:00 2001 From: James Bonwick Date: Thu, 25 Apr 2024 15:31:27 +0100 Subject: [PATCH 2/6] change name --- {github_site => docs}/index.html | 0 {github_site => docs}/test.js | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {github_site => docs}/index.html (100%) rename {github_site => docs}/test.js (100%) diff --git a/github_site/index.html b/docs/index.html similarity index 100% rename from github_site/index.html rename to docs/index.html diff --git a/github_site/test.js b/docs/test.js similarity index 100% rename from github_site/test.js rename to docs/test.js From 7c572952906fa3854863d5178ed71455cb439b2a Mon Sep 17 00:00:00 2001 From: Lorenzo Turrino Date: Thu, 25 Apr 2024 16:01:04 +0100 Subject: [PATCH 3/6] add ci flow --- .../deploy-site/build-and-deploy.yml | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/deploy-site/build-and-deploy.yml diff --git a/.github/workflows/deploy-site/build-and-deploy.yml b/.github/workflows/deploy-site/build-and-deploy.yml new file mode 100644 index 0000000..7630d4d --- /dev/null +++ b/.github/workflows/deploy-site/build-and-deploy.yml @@ -0,0 +1,90 @@ +name: Deploy Next.js site to Pages +# Copy/pasted from https://github.com/actions/starter-workflows/blob/main/pages/nextjs.yml + +on: + # Runs on pushes targeting the test/testing-deploy branch + push: + branches: [test/testing-deploy] + + # Allows you to run this workflow manually from the Actions tab + 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: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Detect package manager + id: detect-package-manager + run: | + if [ -f "${{ github.workspace }}/yarn.lock" ]; then + echo "manager=yarn" >> $GITHUB_OUTPUT + echo "command=install" >> $GITHUB_OUTPUT + echo "runner=yarn" >> $GITHUB_OUTPUT + exit 0 + elif [ -f "${{ github.workspace }}/package.json" ]; then + echo "manager=npm" >> $GITHUB_OUTPUT + echo "command=ci" >> $GITHUB_OUTPUT + echo "runner=npx --no-install" >> $GITHUB_OUTPUT + exit 0 + else + echo "Unable to determine package manager" + exit 1 + fi + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + - name: Setup Pages + uses: actions/configure-pages@v5 + with: + # Automatically inject basePath in your Next.js configuration file and disable + # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). + # + # You may remove this line if you want to manage the configuration yourself. + static_site_generator: next + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + .next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- + - name: Install dependencies + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + - name: Build with Next.js + run: ${{ steps.detect-package-manager.outputs.runner }} next build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./out + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From e73aa7abefaab92b1fe171b432b6f766eacec2f6 Mon Sep 17 00:00:00 2001 From: Lorenzo Turrino Date: Thu, 25 Apr 2024 16:05:01 +0100 Subject: [PATCH 4/6] remove sample deploy files --- docs/index.html | 2 -- docs/test.js | 1 - 2 files changed, 3 deletions(-) delete mode 100644 docs/index.html delete mode 100644 docs/test.js diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 87d7b00..0000000 --- a/docs/index.html +++ /dev/null @@ -1,2 +0,0 @@ -

Hello World!

- \ No newline at end of file diff --git a/docs/test.js b/docs/test.js deleted file mode 100644 index 0781663..0000000 --- a/docs/test.js +++ /dev/null @@ -1 +0,0 @@ -console.log("hi") \ No newline at end of file From b00bb7502c54a31708781380489822266e5e9c56 Mon Sep 17 00:00:00 2001 From: Lorenzo Turrino Date: Thu, 25 Apr 2024 16:10:58 +0100 Subject: [PATCH 5/6] workflow folder --- .github/workflows/{deploy-site => }/build-and-deploy.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{deploy-site => }/build-and-deploy.yml (100%) diff --git a/.github/workflows/deploy-site/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml similarity index 100% rename from .github/workflows/deploy-site/build-and-deploy.yml rename to .github/workflows/build-and-deploy.yml From 1a139636311bcf737a8e17f4c7e5ebea7beb601f Mon Sep 17 00:00:00 2001 From: Lorenzo Turrino Date: Thu, 25 Apr 2024 16:23:02 +0100 Subject: [PATCH 6/6] hotfix: remove testing-library jest-dom types --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 4470707..02d480c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,7 +22,7 @@ "paths": { "@/*": ["./src/*"] }, - "types": ["jest", "@testing-library/jest-dom"], + "types": ["jest"], "typeRoots": ["./node_modules/@types", "./types"] }, "include": [