Skip to content

Update Forest Submodule and Deploy #5

Update Forest Submodule and Deploy

Update Forest Submodule and Deploy #5

Workflow file for this run

name: Update Forest Submodule and Deploy
on:
repository_dispatch:
types: [submodule-updated]
workflow_dispatch:
schedule:
- cron: '0 */6 * * *' # Fallback check every 6 hours
env:
FORESTER_BRANCH : forester-5.0-dev
CACHE_PATHS: |
~/.opam
jobs:
update-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for pushing updates
pages: write # Needed for deploying to Pages
steps:
- name: Set up OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 5.2.0
- name: Restore Forester
uses: actions/cache/restore@v3
id: cache-forester-restore
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-${{ env.FORESTER_BRANCH }}
- name: Download and install Forester
if: steps.cache-forester-restore.outputs.cache-hit != 'true'
run: |
opam update
git clone https://git.sr.ht/~jonsterling/ocaml-forester
cd ocaml-forester
git checkout ${{ env.FORESTER_BRANCH }}
dune build
dune install
cd ..
- name: Save Forester
if: steps.cache-forester-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
id: cache-forester-save
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ steps.cache-forester-restore.outputs.cache-primary-key }}
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.ACCESS_TOKEN }}
- name: Update submodule
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git submodule update --remote --recursive
git diff --exit-code || (git add . && git commit -m "Update forest submodule" && git push)
- name: Build site
run: |
./build.sh
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build
token: ${{ secrets.ACCESS_TOKEN }}