Pull definitions from xen-api (scheduled) #801
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull definitions from xen-api (scheduled) | |
on: | |
schedule: | |
# run nightly to keep docs up-to-date | |
- cron: '33 1 * * *' | |
jobs: | |
pull-xapi: | |
runs-on: ubuntu-latest | |
env: | |
JEKYLL_DOCDIR: _build/default/ocaml/doc/jekyll | |
steps: | |
- name: Checkout xapi code | |
uses: actions/checkout@v3 | |
with: | |
repository: xapi-project/xen-api | |
path: xapi | |
fetch-depth: 256 # hopefully this is enough to pull a tag | |
- name: Update ubuntu repos | |
run: sudo apt update | |
- name: Pull configuration from xs-opam | |
run: | | |
curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env | |
- name: Load environment file | |
id: dotenv | |
uses: falti/dotenv-action@v1 | |
- name: Use ocaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
dune-cache: true | |
ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }} | |
opam-local-packages: xapi/*.opam | |
opam-repositories: | | |
xs-opam: ${{ steps.dotenv.outputs.repository }} | |
- name: Install dependencies | |
working-directory: xapi | |
run: opam pin list --short | xargs opam install --deps-only --with-test -v | |
- name: Generate xapi docs | |
working-directory: xapi | |
run: | | |
opam exec -- ./configure | |
opam exec -- make doc-json | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: web | |
- name: Copy files | |
run: cp -r xapi/${{ env.JEKYLL_DOCDIR }}/* web/ | |
- name: Commit and push changes | |
working-directory: web | |
run: | | |
if git diff --quiet && git ls-files --other --directory --exclude-standard | sed q1 ; then | |
echo "No changes, skipping commit and push step" | |
else | |
hash=$(git --git-dir=../xapi/.git rev-parse HEAD) | |
git config --global user.name 'Github action' | |
git config --global user.email 'github-actions-xapi-project-xapi-github-io[bot]@users.noreply.github.com' | |
git add . # add untracked files as well | |
git commit -m "deploy: https://github.com/xapi-project/xen-api/commit/$hash" | |
git push | |
fi |