diff --git a/.github/workflows/page.yaml b/.github/workflows/page.yaml deleted file mode 100644 index fda31bf..0000000 --- a/.github/workflows/page.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Generate page - -on: - push: - paths: - - 'doc/**' - workflow_call: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - mdbook: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Nix - uses: nixbuild/nix-quick-install-action@v28 - with: - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup mdbook - run: nix develop .#ci - - - name: Generate pages - run: | - which mdbook - mdbook build - - - name: Copy book to page branch - run: | - git checkout page || git checkout --orphan page - find . -mindepth 1 -maxdepth 1 ! -name 'result-book' ! -name '.git' -exec rm -rf {} + - mv result-book/* ./ - rm result-book -r - git add . - - - name: Push book - uses: stefanzweifel/git-auto-commit-action@v5 - with: - branch: page - commit_message: "docs: auto update" - commit_author: Burgess Chang - commit_user_name: github-actions[bot] - commit_user_email: github-actions[bot]@users.noreply.github.com diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 0000000..16db33c --- /dev/null +++ b/.github/workflows/pages.yaml @@ -0,0 +1,48 @@ +name: pages + +on: + push: + branches: + - main + workflow_call: + workflow_dispatch: + +concurrency: + group: pages + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install nix + uses: cachix/install-nix-action@v25 + + - name: Setup pages + uses: actions/configure-pages@v4 + + - name: Build doc + run: | + nix build ./doc + cp -r --no-preserve=all result/ _site + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + deploy: + name: deploy + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + id-token: write + pages: write + steps: + - name: Deploy pages + id: deployment + uses: actions/deploy-pages@v4