Skip to content

Commit 8aa4631

Browse files
pre render scripts in gh-actions (#492)
1 parent 99ebe58 commit 8aa4631

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
with:
2626
version: pre-release
2727

28+
- name: Install jq
29+
run: sudo apt-get install jq
30+
2831
- name: Restore cached _freeze folder
2932
id: cache-primes-restore
3033
uses: actions/cache/restore@v4
@@ -35,6 +38,33 @@ jobs:
3538
restore-keys: |
3639
${{ runner.os }}-primes
3740
41+
- name: Extract version from _quarto.yml
42+
id: extract_version
43+
run: |
44+
minor_version=$(grep -oP 'text:\s+"v\K\d+\.\d+' _quarto.yml)
45+
echo "minor_version=$minor_version" >> $GITHUB_ENV
46+
47+
- name: Fetch latest bugfix version for the extracted minor version
48+
id: fetch_latest_bugfix
49+
run: |
50+
repo_url="https://api.github.com/repos/TuringLang/Turing.jl/tags"
51+
tags=$(curl -s $repo_url | jq -r '.[].name')
52+
stable_tags=$(echo "$tags" | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+$')
53+
latest_bugfix=$(echo "$stable_tags" | grep "^v${{ env.minor_version }}" | sort -rV | head -n 1)
54+
echo "version=$latest_bugfix" >> $GITHUB_ENV
55+
56+
- name: Fetch the actual latest bugfix version
57+
id: fetch_latest_bugfix_actual
58+
run: |
59+
latest=$(curl --silent "https://api.github.com/repos/TuringLang/Turing.jl/releases/latest" | jq -r .tag_name)
60+
echo "LATEST=$latest" >> $GITHUB_ENV
61+
62+
- name: Run Changelog and Versions Scripts
63+
if: env.version == env.LATEST
64+
run: |
65+
sh assets/scripts/changelog.sh
66+
sh assets/scripts/versions.sh
67+
3868
- name: Render Quarto site
3969
run: quarto render
4070

@@ -49,9 +79,6 @@ jobs:
4979
_freeze/
5080
key: ${{ runner.os }}-primes-${{ github.run_id }}
5181

52-
- name: Install jq
53-
run: sudo apt-get install jq
54-
5582
- name: Fetch search_original.json from main site
5683
run: curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/gh-pages/search_original.json
5784

@@ -65,27 +92,6 @@ jobs:
6592
run: |
6693
jq -s '.[0] + .[1]' _site/search_original.json fixed_main_search.json > _site/search.json
6794
68-
- name: Extract version from _quarto.yml
69-
id: extract_version
70-
run: |
71-
minor_version=$(grep -oP 'text:\s+"v\K\d+\.\d+' _quarto.yml)
72-
echo "minor_version=$minor_version" >> $GITHUB_ENV
73-
74-
- name: Fetch latest bugfix version for the extracted minor version
75-
id: fetch_latest_bugfix
76-
run: |
77-
repo_url="https://api.github.com/repos/TuringLang/Turing.jl/tags"
78-
tags=$(curl -s $repo_url | jq -r '.[].name')
79-
stable_tags=$(echo "$tags" | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+$')
80-
latest_bugfix=$(echo "$stable_tags" | grep "^v${{ env.minor_version }}" | sort -rV | head -n 1)
81-
echo "version=$latest_bugfix" >> $GITHUB_ENV
82-
83-
- name: Fetch the actual latest bugfix version
84-
id: fetch_latest_bugfix_actual
85-
run: |
86-
latest=$(curl --silent "https://api.github.com/repos/TuringLang/Turing.jl/releases/latest" | jq -r .tag_name)
87-
echo "LATEST=$latest" >> $GITHUB_ENV
88-
8995
- name: Deploy versioned docs
9096
uses: JamesIves/github-pages-deploy-action@v4
9197
with:

_quarto.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ project:
44
# Change port if it's busy in your system or just remove this line so that It will automatically use any free port
55
port: 4200
66
browser: true
7-
pre-render:
8-
- sh assets/scripts/changelog.sh
9-
- sh assets/scripts/versions.sh
107

118
# These cannot be used as variables. They are reserved for the project configuration.
129
website:

0 commit comments

Comments
 (0)