From 67c8c97654efc2219c7b931b99d0d95d4541a5a8 Mon Sep 17 00:00:00 2001 From: Aylur Date: Wed, 4 Sep 2024 22:39:08 +0200 Subject: add gi docs deploy workflow --- .github/workflows/gi-docs.yml | 64 +++++++++++++++++++++++++++++++++++++++++ .github/workflows/pages.yml | 53 ---------------------------------- .github/workflows/vitepress.yml | 52 +++++++++++++++++++++++++++++++++ docs/showcases/Showcase.vue | 2 -- 4 files changed, 116 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/gi-docs.yml delete mode 100644 .github/workflows/pages.yml create mode 100644 .github/workflows/vitepress.yml diff --git a/.github/workflows/gi-docs.yml b/.github/workflows/gi-docs.yml new file mode 100644 index 0000000..774e2c1 --- /dev/null +++ b/.github/workflows/gi-docs.yml @@ -0,0 +1,64 @@ +name: Deploy GI docs + +on: + push: + branches: [main] + +permissions: + contents: write + pages: write + id-token: write + +jobs: + gi-docs: + runs-on: ubuntu-latest + steps: + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + logger: pretty + + - name: Checkout Source Repository + uses: actions/checkout@v4 + with: + path: src + + - name: Build Documentation + run: | + cd src + nix build .#docs --print-build-logs + + - name: Checkout Destination Repo + uses: actions/checkout@v4 + with: + token: ${{ secrets.token }} + repository: aylur/aylur.github.io + ref: main + path: dist + + - name: Configure Git + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "GitHub Actions Bot" + + - name: Clean and Copy Files + run: | + rm -rf dist/libastal + cp -r src/result/libastal dist/libastal + + - name: Check for Changes + run: | + cd dist + git add . + if git diff --cached --quiet; then + echo "No changes to commit." + exit 0 + else + echo "Changes detected, proceeding with commit." + fi + + - name: Push to Pages Repo + run: | + cd dist + git commit -m "Deployed from https://github.com/${{ github.repository }}/commit/${{ github.sha }}" + git push origin main diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml deleted file mode 100644 index 85dd738..0000000 --- a/.github/workflows/pages.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Deploy VitePress site to Pages - -on: - push: - branches: [main] - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -jobs: - vitepress: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Not needed if lastUpdated is not enabled - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Setup Pages - uses: actions/configure-pages@v4 - - - name: Install dependencies - run: npm ci - working-directory: docs - - - name: Build with VitePress - run: npm run build - working-directory: docs - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: docs/dist - - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - needs: vitepress - runs-on: ubuntu-latest - name: Deploy - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/vitepress.yml b/.github/workflows/vitepress.yml new file mode 100644 index 0000000..c551170 --- /dev/null +++ b/.github/workflows/vitepress.yml @@ -0,0 +1,52 @@ +name: Deploy VitePress site + +on: + push: + branches: [main] + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build-vitepress: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Not needed if lastUpdated is not enabled + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Install dependencies + run: npm ci + working-directory: docs + + - name: Build with VitePress + run: npm run build + working-directory: docs + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/dist + + deploy-vitepress: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: vitepress + runs-on: ubuntu-latest + name: Deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/showcases/Showcase.vue b/docs/showcases/Showcase.vue index 46d2138..5873a8e 100644 --- a/docs/showcases/Showcase.vue +++ b/docs/showcases/Showcase.vue @@ -1,6 +1,4 @@