Something went wrong. Try again.
forked from nix-community/nixvim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166name: Documentation
on: push: branches: - main # Allow running manually workflow_dispatch:
# Allow one concurrent deploymentconcurrency: group: docs-website cancel-in-progress: true
defaults: run: shell: bash
jobs: prepare: name: Version info runs-on: ubuntu-slim
outputs: matrix: ${{ steps.matrix.outputs.result }} versions: ${{ steps.versions.outputs.result }}
steps: - name: Checkout version-info uses: actions/checkout@v7 with: sparse-checkout: version-info.toml sparse-checkout-cone-mode: false
- name: Produce build matrix id: matrix run: | { echo -n "result=" yq --no-colors --output-format=json --indent=0 ' [ .versions | to_entries | reverse | .[] | { "ref": .value.branch, "name": .key, "base-href": "/nixvim/" } | select(.ref != "main").sub-path = .name | select(.ref != "main").base-href = "\(.base-href)\(.name)/" ] ' version-info.toml } >> "$GITHUB_OUTPUT"
- name: Produce "other versions" array id: versions run: | { echo -n "result=" yq --no-colors --output-format=json --indent=0 ' [ .versions | to_entries | reverse | .[] | { "branch": .value.branch, "nixpkgsBranch": .value.channel, "baseHref": "/nixvim/\(.key)/", "status": .value.status } | select(.branch == "main").baseHref = "/nixvim/" ] ' version-info.toml } >> "$GITHUB_OUTPUT"
build: name: Build ${{ matrix.name }} runs-on: ubuntu-latest needs: prepare
strategy: fail-fast: true matrix: include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps: - name: Install nix uses: cachix/install-nix-action@v31
- name: Configure cachix uses: cachix/cachix-action@v17 with: name: nix-community authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
# Build the `docs` flake output from the corresponding branch # Uses --impure to enable `getEnv` - name: Build docs env: ref: ${{ matrix.ref }} outLink: build/${{ matrix.sub-path }} NIXVIM_DOCS_BASE_HREF: ${{ matrix.base-href }} NIXVIM_DOCS_AVAILABLE_VERSIONS: ${{ needs.prepare.outputs.versions }} run: | nix build "github:$GITHUB_REPOSITORY/$ref#docs" --impure --out-link "$outLink"
- name: Upload artifact uses: actions/upload-pages-artifact@v5 with: path: build name: ${{ matrix.name }}-docs retention-days: 1
combine: name: Combine builds runs-on: ubuntu-24.04-arm needs: build
env: in: artifacts out: combined
steps: - name: Download artifacts uses: actions/download-artifact@v8 with: path: ${{ env.in }} pattern: "*-docs" merge-multiple: false
- name: Extract archives run: | mkdir -p "$out" find "$in" -name artifact.tar \ | parallel tar \ --verbose \ --extract \ --file {} \ --directory "$out"
- name: Upload artifact uses: actions/upload-pages-artifact@v5 with: path: ${{ env.out }}
deploy: name: Deploy runs-on: ubuntu-24.04-arm needs: combine
permissions: pages: write # to deploy to Pages id-token: write # to verify the deployment originates from an appropriate source
environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}
steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v5