blob: 6275dea6d26da6b83850ef866b960cdea8780ffb [file] [log] [blame]
name: Merge actions
on:
push:
branches:
- master
jobs:
build:
name: Build documentation
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
# BuildStream requires tags to be able to find its version.
with:
fetch-depth: 0
- name: Give `testuser` ownership of the source directory
run: sudo chown -R 1000:1000 ${GITHUB_WORKSPACE}
- name: Build documentation using Docker Compose
run: |
docker-compose \
--env-file ${GITHUB_WORKSPACE}/.github/common.env \
--file ${GITHUB_WORKSPACE}/.github/compose/ci.docker-compose.yml \
run \
docs
# Restore permissions to the current user
sudo chown -R ${USER} ${GITHUB_WORKSPACE}
# Include a tarball in the published docs, allowing for
# easy re-publishing of master docs on docs.buildstream.build
tar -C doc/build/html -zcf docs.tgz .
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: docs
path: |
doc/build/html
docs.tgz
publish:
needs: build
runs-on: ubuntu-20.04
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: docs
path: docs
- name: Checkout code
uses: actions/checkout@v2
with:
ref: gh-pages
path: pages
- name: Update repo
run: |
# Copy the docs asset over and overwrite the orphan gh-pages branch, ensure
# that we disable GitHub's jekyll by creating the .nojekyll file, otherwise
# it will interfere with the rendering of the site.
#
mkdir -p pages/docs
cp -a docs/doc/build/html/* pages/docs/
cp -a docs/docs.tgz pages/docs/
touch pages/docs/.nojekyll
cd pages/
git add .
git config --local user.email "merge-ci@ponyland"
git config --local user.name "Github Actions Nightly Job"
git commit -m "Update repo for docs build $GITHUB_RUN_NUMBER"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" gh-pages