diff --git a/.github/workflows/build_website.yaml b/.github/workflows/build_website.yaml new file mode 100644 index 00000000..d47aa735 --- /dev/null +++ b/.github/workflows/build_website.yaml @@ -0,0 +1,78 @@ +name: Build and Deploy Documentation Website + +on: + push: + branches: + - main + - create-documentation-site-for-keymaps + paths: + - 'keyboards/**/layout.yaml' + - 'website/**' + - 'scripts/**' + - '.github/workflows/build_website.yaml' + 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: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: website/package-lock.json + + - name: Install keymap-drawer + run: pip install keymap-drawer + + - name: Install Node.js dependencies + working-directory: website + run: npm ci + + - name: Generate SVG diagrams + run: node scripts/generate-svgs.js + + - name: Build website with Eleventy + working-directory: website + run: npm run build + + - name: Create .nojekyll file + working-directory: website + run: touch _site/.nojekyll + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: website/_site + + 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