From fabd20af9a3c16e475bc85487445ed57b4e53356 Mon Sep 17 00:00:00 2001 From: Kelvin Olaiya <73821880+kelvin-olaiya@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:01:21 +0200 Subject: [PATCH] docs(website): add job to build website (#189) * docs(website): rename website folder * ci: add job to build website * ci: install dependecies before building website * ci: deploy website * ci: success also depend on the deployment of the website --- .github/workflows/build.yml | 53 +++++++++++++++++- docs/{site => website}/.gitignore | 0 docs/{site => website}/babel.config.js | 0 docs/{site => website}/docs/intro.md | 0 .../docs/report/01-requirements.md | 0 docs/{site => website}/docs/report/02-ddd.md | 0 .../docs/report/03-architecture.md | 0 .../docs/report/04-detailed-design.md | 0 .../docs/report/05-implementation.md | 0 .../docs/report/06-testing.md | 0 .../docs/report/07-deployment.md | 0 .../docs/report/08-conclusions.md | 0 .../docs/report/_category_.json | 0 docs/{site => website}/docusaurus.config.ts | 2 +- docs/{site => website}/package-lock.json | 0 docs/{site => website}/package.json | 0 docs/{site => website}/sidebars.ts | 0 docs/{site => website}/src/pages/index.md | 0 docs/{site => website}/static/.nojekyll | 0 .../static/img/docusaurus-social-card.jpg | Bin .../static/img/docusaurus.png | Bin docs/{site => website}/static/img/favicon.ico | Bin docs/{site => website}/static/img/logo.svg | 0 .../static/img/undraw_docusaurus_mountain.svg | 0 .../static/img/undraw_docusaurus_react.svg | 0 .../static/img/undraw_docusaurus_tree.svg | 0 docs/{site => website}/tsconfig.json | 0 27 files changed, 51 insertions(+), 4 deletions(-) rename docs/{site => website}/.gitignore (100%) rename docs/{site => website}/babel.config.js (100%) rename docs/{site => website}/docs/intro.md (100%) rename docs/{site => website}/docs/report/01-requirements.md (100%) rename docs/{site => website}/docs/report/02-ddd.md (100%) rename docs/{site => website}/docs/report/03-architecture.md (100%) rename docs/{site => website}/docs/report/04-detailed-design.md (100%) rename docs/{site => website}/docs/report/05-implementation.md (100%) rename docs/{site => website}/docs/report/06-testing.md (100%) rename docs/{site => website}/docs/report/07-deployment.md (100%) rename docs/{site => website}/docs/report/08-conclusions.md (100%) rename docs/{site => website}/docs/report/_category_.json (100%) rename docs/{site => website}/docusaurus.config.ts (99%) rename docs/{site => website}/package-lock.json (100%) rename docs/{site => website}/package.json (100%) rename docs/{site => website}/sidebars.ts (100%) rename docs/{site => website}/src/pages/index.md (100%) rename docs/{site => website}/static/.nojekyll (100%) rename docs/{site => website}/static/img/docusaurus-social-card.jpg (100%) rename docs/{site => website}/static/img/docusaurus.png (100%) rename docs/{site => website}/static/img/favicon.ico (100%) rename docs/{site => website}/static/img/logo.svg (100%) rename docs/{site => website}/static/img/undraw_docusaurus_mountain.svg (100%) rename docs/{site => website}/static/img/undraw_docusaurus_react.svg (100%) rename docs/{site => website}/static/img/undraw_docusaurus_tree.svg (100%) rename docs/{site => website}/tsconfig.json (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fdb70020..4d0d3fc7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: - name: Build run: ./gradlew build --info - name: Test - run: ./gradlew auth:test user:test alarm:test device:test log:test notification:test location:test --info + run: ./gradlew auth:test user:test alarm:test device:test log:test notification:test location:test --info --parallel style: runs-on: ubuntu-latest steps: @@ -42,7 +42,28 @@ jobs: run: ./gradlew format --info - name: Check lint run: ./gradlew lint --info + build-website: + defaults: + run: + working-directory: docs/website + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: package.json + - name: Build the website + run: | + npm install + npm run build + - uses: actions/upload-artifact@v4.3.4 + with: + name: website + path: docs/website/build compute-next-version: + needs: + - build + - style runs-on: ubuntu-latest permissions: contents: write @@ -70,8 +91,8 @@ jobs: echo "The next version is ${{ steps.compute-next-version.outputs.next-version }}" release: needs: - - build - - style + - compute-next-version + - build-website runs-on: ubuntu-latest concurrency: # Only one release job at a time per branch, strictly sequential. @@ -105,6 +126,30 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} run: npx semantic-release + deploy-website: + defaults: + run: + working-directory: docs/website + runs-on: ubuntu-latest + needs: + - build-website + - release + if: >- + !github.event.repository.fork + && ( + github.event_name != 'pull_request' + || github.event.pull_request.head.repo.full_name == github.repository + ) && fromJSON(needs.compute-next-version.outputs.will-release) + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4.1.8 + with: + name: website + path: docs/website/build + - uses: JamesIves/github-pages-deploy-action@v4 + with: + token: ${{ secrets.GH_TOKEN }} + folder: docs/website/build docker: name: Push ${{ matrix.image }} image to docker hub concurrency: @@ -164,9 +209,11 @@ jobs: needs: - build - style + - build-website - release - docker - compute-next-version + - deploy-website # Always run this job, even if the previous jobs failed if: >- always() && (failure() || !contains(join(needs.*.result, ','), 'cancelled')) diff --git a/docs/site/.gitignore b/docs/website/.gitignore similarity index 100% rename from docs/site/.gitignore rename to docs/website/.gitignore diff --git a/docs/site/babel.config.js b/docs/website/babel.config.js similarity index 100% rename from docs/site/babel.config.js rename to docs/website/babel.config.js diff --git a/docs/site/docs/intro.md b/docs/website/docs/intro.md similarity index 100% rename from docs/site/docs/intro.md rename to docs/website/docs/intro.md diff --git a/docs/site/docs/report/01-requirements.md b/docs/website/docs/report/01-requirements.md similarity index 100% rename from docs/site/docs/report/01-requirements.md rename to docs/website/docs/report/01-requirements.md diff --git a/docs/site/docs/report/02-ddd.md b/docs/website/docs/report/02-ddd.md similarity index 100% rename from docs/site/docs/report/02-ddd.md rename to docs/website/docs/report/02-ddd.md diff --git a/docs/site/docs/report/03-architecture.md b/docs/website/docs/report/03-architecture.md similarity index 100% rename from docs/site/docs/report/03-architecture.md rename to docs/website/docs/report/03-architecture.md diff --git a/docs/site/docs/report/04-detailed-design.md b/docs/website/docs/report/04-detailed-design.md similarity index 100% rename from docs/site/docs/report/04-detailed-design.md rename to docs/website/docs/report/04-detailed-design.md diff --git a/docs/site/docs/report/05-implementation.md b/docs/website/docs/report/05-implementation.md similarity index 100% rename from docs/site/docs/report/05-implementation.md rename to docs/website/docs/report/05-implementation.md diff --git a/docs/site/docs/report/06-testing.md b/docs/website/docs/report/06-testing.md similarity index 100% rename from docs/site/docs/report/06-testing.md rename to docs/website/docs/report/06-testing.md diff --git a/docs/site/docs/report/07-deployment.md b/docs/website/docs/report/07-deployment.md similarity index 100% rename from docs/site/docs/report/07-deployment.md rename to docs/website/docs/report/07-deployment.md diff --git a/docs/site/docs/report/08-conclusions.md b/docs/website/docs/report/08-conclusions.md similarity index 100% rename from docs/site/docs/report/08-conclusions.md rename to docs/website/docs/report/08-conclusions.md diff --git a/docs/site/docs/report/_category_.json b/docs/website/docs/report/_category_.json similarity index 100% rename from docs/site/docs/report/_category_.json rename to docs/website/docs/report/_category_.json diff --git a/docs/site/docusaurus.config.ts b/docs/website/docusaurus.config.ts similarity index 99% rename from docs/site/docusaurus.config.ts rename to docs/website/docusaurus.config.ts index afad0dde8..225fcce1c 100644 --- a/docs/site/docusaurus.config.ts +++ b/docs/website/docusaurus.config.ts @@ -11,7 +11,7 @@ const config: Config = { url: 'https://mala1180.github.io', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/', + baseUrl: '/revue/', // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. diff --git a/docs/site/package-lock.json b/docs/website/package-lock.json similarity index 100% rename from docs/site/package-lock.json rename to docs/website/package-lock.json diff --git a/docs/site/package.json b/docs/website/package.json similarity index 100% rename from docs/site/package.json rename to docs/website/package.json diff --git a/docs/site/sidebars.ts b/docs/website/sidebars.ts similarity index 100% rename from docs/site/sidebars.ts rename to docs/website/sidebars.ts diff --git a/docs/site/src/pages/index.md b/docs/website/src/pages/index.md similarity index 100% rename from docs/site/src/pages/index.md rename to docs/website/src/pages/index.md diff --git a/docs/site/static/.nojekyll b/docs/website/static/.nojekyll similarity index 100% rename from docs/site/static/.nojekyll rename to docs/website/static/.nojekyll diff --git a/docs/site/static/img/docusaurus-social-card.jpg b/docs/website/static/img/docusaurus-social-card.jpg similarity index 100% rename from docs/site/static/img/docusaurus-social-card.jpg rename to docs/website/static/img/docusaurus-social-card.jpg diff --git a/docs/site/static/img/docusaurus.png b/docs/website/static/img/docusaurus.png similarity index 100% rename from docs/site/static/img/docusaurus.png rename to docs/website/static/img/docusaurus.png diff --git a/docs/site/static/img/favicon.ico b/docs/website/static/img/favicon.ico similarity index 100% rename from docs/site/static/img/favicon.ico rename to docs/website/static/img/favicon.ico diff --git a/docs/site/static/img/logo.svg b/docs/website/static/img/logo.svg similarity index 100% rename from docs/site/static/img/logo.svg rename to docs/website/static/img/logo.svg diff --git a/docs/site/static/img/undraw_docusaurus_mountain.svg b/docs/website/static/img/undraw_docusaurus_mountain.svg similarity index 100% rename from docs/site/static/img/undraw_docusaurus_mountain.svg rename to docs/website/static/img/undraw_docusaurus_mountain.svg diff --git a/docs/site/static/img/undraw_docusaurus_react.svg b/docs/website/static/img/undraw_docusaurus_react.svg similarity index 100% rename from docs/site/static/img/undraw_docusaurus_react.svg rename to docs/website/static/img/undraw_docusaurus_react.svg diff --git a/docs/site/static/img/undraw_docusaurus_tree.svg b/docs/website/static/img/undraw_docusaurus_tree.svg similarity index 100% rename from docs/site/static/img/undraw_docusaurus_tree.svg rename to docs/website/static/img/undraw_docusaurus_tree.svg diff --git a/docs/site/tsconfig.json b/docs/website/tsconfig.json similarity index 100% rename from docs/site/tsconfig.json rename to docs/website/tsconfig.json