ci: fix building the search index #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Deploy Preview" | |
on: | |
pull_request: | |
# allow repository maintainers to modify and test workflow | |
paths: | |
- ".github/workflows/deploy-preview.yaml" | |
pull_request_target: # zizmor: ignore[dangerous-triggers] | |
# enable runs for this workflow when labeled as safe only | |
# prevent execution when the workflow itself is modified from a fork | |
types: | |
- labeled | |
- synchronize | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
deploy-preview: | |
name: Build & Deploy | |
runs-on: ubuntu-latest | |
if: | | |
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe')) | |
|| (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Build Assets | |
run: npm ci && npm run prod | |
# Must be run after "npm ci" because installing hugo-bin | |
# removes the vendor directory that is created by "bundle install" | |
# https://github.com/fenneclab/hugo-bin/blob/a5500e4f622f46886947d3438243bd97cfe6c04c/lib/install.js#L28-L30 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
bundler-cache: true | |
- name: Fetch Documentation | |
run: | | |
python -m pip install poetry | |
poetry install --no-root --only main | |
poetry run python bin/website build | |
- name: Build | |
run: npx hugo --minify --logLevel info | |
- name: Build search index | |
run: | | |
bundle exec bin/build_index.rb |