mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Merge pull request #4814 from roc-lang/fix_tutorial_deployment
build tutorial with roc nightly
This commit is contained in:
commit
d7a3e5e1fb
@ -16,7 +16,7 @@ jobs:
|
||||
run: curl https://api.github.com/repos/roc-lang/roc/releases > roc_releases.json
|
||||
|
||||
- name: get the url of today`s release for macos apple silicon
|
||||
run: echo "RELEASE_URL=$(./ci/get_latest_release_url.sh silicon)" >> $GITHUB_ENV
|
||||
run: echo "RELEASE_URL=$(./ci/get_today_release_url.sh silicon)" >> $GITHUB_ENV
|
||||
|
||||
- name: Get the archive from the url.
|
||||
run: curl -OL ${{ env.RELEASE_URL }}
|
||||
|
4
.github/workflows/test_nightly_many_os.yml
vendored
4
.github/workflows/test_nightly_many_os.yml
vendored
@ -29,11 +29,11 @@ jobs:
|
||||
|
||||
- name: get the url of today`s release for linux (x86_64)
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: echo "RELEASE_URL=$(./ci/get_latest_release_url.sh linux_x86_64)" >> $GITHUB_ENV
|
||||
run: echo "RELEASE_URL=$(./ci/get_today_release_url.sh linux_x86_64)" >> $GITHUB_ENV
|
||||
|
||||
- name: get the url of today`s release for macos (x86_64)
|
||||
if: startsWith(matrix.os, 'macos')
|
||||
run: echo "RELEASE_URL=$(./ci/get_latest_release_url.sh macos_x86_64)" >> $GITHUB_ENV
|
||||
run: echo "RELEASE_URL=$(./ci/get_today_release_url.sh macos_x86_64)" >> $GITHUB_ENV
|
||||
|
||||
- name: get the archive from the url
|
||||
run: curl -OL ${{ env.RELEASE_URL }}
|
||||
|
@ -5,12 +5,12 @@
|
||||
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
||||
set -euxo pipefail
|
||||
|
||||
LATEST_RELEASE_URL=`cat roc_releases.json | jq --arg arch $1 --arg today $(date +'%Y-%m-%d') '.[0] | .assets | map(.browser_download_url) | map(select(. | contains("\($arch)-\($today)"))) | .[0]'`
|
||||
LATEST_RELEASE_URL=`cat roc_releases.json | jq --arg arch $1 '.[0] | .assets | map(.browser_download_url) | map(select(. | contains("\($arch)-"))) | last'`
|
||||
|
||||
if [[ "$LATEST_RELEASE_URL" == "null" ]]
|
||||
then
|
||||
echo "I expected to get a url but I got null instead. Today's release may not have been uploaded?"
|
||||
echo "I expected to get a url but I got null instead. The provided argument for this bash script may not have had any matches when used as arch in the jq query above."
|
||||
exit 1
|
||||
else
|
||||
echo $LATEST_RELEASE_URL | sed s/\"//g
|
||||
fi
|
||||
fi
|
||||
|
16
ci/get_today_release_url.sh
Executable file
16
ci/get_today_release_url.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# assumes roc_releases.json is present
|
||||
|
||||
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
||||
set -euxo pipefail
|
||||
|
||||
TODAY_RELEASE_URL=`cat roc_releases.json | jq --arg arch $1 --arg today $(date +'%Y-%m-%d') '.[0] | .assets | map(.browser_download_url) | map(select(. | contains("\($arch)-\($today)"))) | .[0]'`
|
||||
|
||||
if [[ "$TODAY_RELEASE_URL" == "null" ]]
|
||||
then
|
||||
echo "I expected to get a url but I got null instead. Today's release may not have been uploaded?"
|
||||
exit 1
|
||||
else
|
||||
echo $TODAY_RELEASE_URL | sed s/\"//g
|
||||
fi
|
25
www/build.sh
25
www/build.sh
@ -52,11 +52,26 @@ mv generated-docs/ www/build/builtins # move all the folders to build/builtins/
|
||||
# Manually add this tip to all the builtin docs.
|
||||
find www/build/builtins -type f -name 'index.html' -exec sed -i 's!</nav>!<div class="builtins-tip"><b>Tip:</b> <a href="/different-names">Some names</a> differ from other languages.</div></nav>!' {} \;
|
||||
|
||||
# TODO to enable this, we either need to install LLVM on Netlify or get it working using the dev backend.
|
||||
# echo 'Building tutorial.html from tutorial.md...'
|
||||
# mkdir www/build/tutorial
|
||||
# cargo run --release run www/generate_tutorial/src/tutorial.roc -- www/generate_tutorial/src/input/ www/build/tutorial/
|
||||
# mv www/build/tutorial/tutorial.html www/build/tutorial/index.html
|
||||
|
||||
echo 'Fetching latest roc nightly...'
|
||||
curl https://api.github.com/repos/roc-lang/roc/releases > roc_releases.json
|
||||
# get the url of the latest release
|
||||
export ROC_RELEASE_URL=$(./ci/get_latest_release_url.sh linux_x86_64)
|
||||
# get roc release archive
|
||||
curl -OL $ROC_RELEASE_URL
|
||||
# extract archive
|
||||
ls | grep "roc_nightly" | xargs tar --one-top-level=roc_nightly -xzvf
|
||||
# delete archive
|
||||
ls | grep "roc_nightly.*tar.gz" | xargs rm
|
||||
|
||||
echo 'Building tutorial.html from tutorial.md...'
|
||||
mkdir www/build/tutorial
|
||||
./roc_nightly/roc version
|
||||
./roc_nightly/roc run www/generate_tutorial/src/tutorial.roc -- www/generate_tutorial/src/input/ www/build/tutorial/
|
||||
mv www/build/tutorial/tutorial.html www/build/tutorial/index.html
|
||||
|
||||
# cleanup roc
|
||||
rm -rf roc_nightly roc_releases.json
|
||||
|
||||
echo 'Generating CLI example platform docs...'
|
||||
# Change ROC_DOCS_ROOT_DIR=builtins so that links will be generated relative to
|
||||
|
Loading…
Reference in New Issue
Block a user