Skip to content

Add a Better Auto Docs Site Generator for Arbitrary claro_binary() Ta… #497

Add a Better Auto Docs Site Generator for Arbitrary claro_binary() Ta…

Add a Better Auto Docs Site Generator for Arbitrary claro_binary() Ta… #497

name: Deploy
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
Build-and-Release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build Release Artifacts
run: |
# In order to be able to run the Claro CLIs users will need the compiler and builtin Java deps Jars.
bazel build //src/java/com/claro:claro_compiler_binary_deploy.jar
bazel build //examples/claro_programs:claro_builtin_java_deps_deploy.jar
# Create a single tar file to encapsulate all CLI resources.
ln -s bazel-bin/src/java/com/claro/claro_compiler_binary_deploy.jar claro_compiler_binary_deploy.jar
ln -s bazel-bin/examples/claro_programs/claro_builtin_java_deps_deploy.jar claro_builtin_java_deps_deploy.jar
# -h ensures that the above symlinks are actually dereferenced, else they'd be empty symlinks in the tar file.
tar -hcf claro-cli-install.tar.gz \
claro_compiler_binary_deploy.jar \
claro_builtin_java_deps_deploy.jar
# Create a source archive that will have a stable hash. The one that GitHub automatically produces will not
# be able to guarantee a stable hash, see: https://blog.bazel.build/2023/02/15/github-archive-checksum.html.
git archive -o claro-source-archive-v0.1.${{ github.run_number }}.zip HEAD
# Create the cli tool that will be used for new users to get their first Claro project correctly configured.
bazel build //tools:create_claro_project_script
ln -s bazel-bin/tools/create_claro_project.sh create_claro_project.sh
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v0.1.${{ github.run_number }}
name: v0.1.${{ github.run_number }} Automated Release
body: |
# This is an automated release v0.1.${{ github.run_number }}.
Check out the simple [setup instructions](https://github.com/JasonSteving99/claro-lang/#create-your-own-claro-project-with-bazel) to get started!
draft: false
prerelease: false
fail_on_unmatched_files: true
files: |
create_claro_project.sh
claro-cli-install.tar.gz
claro-source-archive-v0.1.${{ github.run_number }}.zip
Deploy-User-Docs-to-GH-Pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.36/mdbook-v0.4.36-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
# The docs are auto-generated to ensure that the examples are always up-to-date and actually run.
bazel run //mdbook_docs/src:write_all_docs && bazel test //mdbook_docs/src/...
if [ $? -eq 0 ]; then
echo "Successfully Generated Docs"
else
echo "Failed to Build Docs"
exit 1
fi
cd mdbook_docs
mdbook build
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email "[email protected]"
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/* .
# Make sure that the GH Pages site has the CNAME file.
cp ../../CNAME .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages