summaryrefslogtreecommitdiff
path: root/.github/workflows/gi-docs.yml
blob: 565b6d53f71758404731d36186a3cf39b6f69c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
          mkdir dist/libastal
          cp -r src/result/* dist/libastal

      - name: Push to Pages Repo
        run: |
          cd dist
          git add .
          if [ -n "$(git diff --cached)" ]; then
            git commit -m "Deployed from https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
            git push origin main
          fi