Skip to content

Versioning of website based on Turing's versions (#478) #39

Versioning of website based on Turing's versions (#478)

Versioning of website based on Turing's versions (#478) #39

Workflow file for this run

name: Render Docs Website
on:
push:
branches:
- master
workflow_dispatch: # manual trigger for testing
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.10'
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: pre-release
- name: Restore cached _freeze folder
id: cache-primes-restore
uses: actions/cache/restore@v4
with:
path: |
_freeze/
key: ${{ runner.os }}-primes-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-primes
- name: Render Quarto site
run: quarto render
- name: Rename original search index
run: mv _site/search.json _site/search_original.json
- name: Save _freeze folder
id: cache-primes-save
uses: actions/cache/save@v4
with:
path: |
_freeze/
key: ${{ runner.os }}-primes-${{ github.run_id }}
- name: Install jq
run: sudo apt-get install jq
- name: Fetch search_original.json from main site
run: curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/gh-pages/search_original.json
- name: Convert main site search index URLs to relative URLs
run: |
jq 'map(
if .href then .href = "../" + .href else . end |
if .objectID then .objectID = "../" + .objectID else . end)' search_original.json > fixed_main_search.json
- name: Merge both search index
run: |
jq -s '.[0] + .[1]' _site/search_original.json fixed_main_search.json > _site/search.json
- name: Read VERSION file
id: read_version
run: echo "version=$(cat VERSION)" >> $GITHUB_ENV
- name: Fetch latest version from GitHub
id: fetch_latest_version
run: |
latest_version=$(curl --silent "https://api.github.com/repos/TuringLang/Turing.jl/releases/latest" | jq -r .tag_name)
echo "latest_version=$latest_version" >> $GITHUB_ENV
- name: Deploy versioned docs
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: _site
target-folder: versions/${{ env.version }}
clean: false
- name: Deploy latest docs to root
if: env.version == env.latest_version
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: _site
clean: false