From 3d4f61419af5569eb1ca907c58ad4716bbc71994 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 8 Dec 2024 12:28:50 +1100 Subject: [PATCH] Setup starlight workflow --- .github/workflows/v3-docs.yml | 81 ++++++++++++++++++++++++++--------- docs/CNAME | 1 + 2 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 docs/CNAME diff --git a/.github/workflows/v3-docs.yml b/.github/workflows/v3-docs.yml index 6cb472db3..36bec09b6 100644 --- a/.github/workflows/v3-docs.yml +++ b/.github/workflows/v3-docs.yml @@ -1,35 +1,76 @@ -name: v3 docs +name: Deploy Starlight Docs on: push: branches: - v3-alpha paths: - - 'mkdocs-website/**/*' + - 'docs/**/*' + permissions: - contents: write + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + jobs: - deploy: + build: runs-on: ubuntu-latest if: github.event.repository.fork == false defaults: run: - working-directory: ./mkdocs-website + working-directory: ./docs # Set working directory to docs + steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v3 + node-version: 18 + cache: 'npm' + + # Cache npm dependencies + - name: Cache npm dependencies + uses: actions/cache@v3 with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | - mkdocs-material- - - run: sudo apt-get install pngquant - - run: pip install pillow cairosvg mkdocs-table-reader-plugin mkdocs-static-i18n - - run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git - - run: mkdocs build --config-file mkdocs.insiders.yml - - run: mkdocs gh-deploy --force -env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + ${{ runner.os }}-node- + + # Cache Astro build + - name: Cache Astro build + uses: actions/cache@v3 + with: + path: | + dist + .astro + key: ${{ runner.os }}-astro-build-${{ hashFiles('src/**/*') }} + restore-keys: | + ${{ runner.os }}-astro-build- + + - name: Install dependencies + run: npm ci + + - name: Build Starlight site + run: npm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 000000000..23caa94af --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +v3alpha.wails.io \ No newline at end of file