diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f505983 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Deploy to GitHub Pages + +# Review gh actions docs if you want to further define triggers, paths, etc +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on +on: + push: + branches: + - main + +jobs: + build: + name: Building the documentation static web site with docusaurus + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build website + run: npm run build + + - name: Upload Build Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + deploy: + name: Deploy to GitHub Pages + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml new file mode 100644 index 0000000..1136b45 --- /dev/null +++ b/.github/workflows/test-deploy.yml @@ -0,0 +1,37 @@ +name: Test deployment +# This just runs the build step, without deploying, so you know that your PR will at least build +# Will it look good ? You need to deploy to know... + +# Review gh actions docs if you want to further define triggers, paths, etc +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on +on: + pull_request: + branches: + - main + +env: + ORGANIZATION_NAME: ${{ github.repository_owner }} + PROJECT_NAME: ${{ github.event.repository.name }} + +jobs: + test-build: + name: Test building the documentation static web site with docusaurus + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: list environment variables + run: | + env && exit 1 + + - name: Test build website + run: npm run build \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index 8b7cbf8..c7ef9d2 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -21,7 +21,7 @@ const config = { url: process.env.DTT_DOCS_URL, // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/', + baseUrl: process.env.DTT_DOCS_BASE_PATH, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these.