| 1 |
name: Merge actions |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
|
| 8 |
jobs: |
| 9 |
build: |
| 10 |
name: Build documentation |
| 11 |
runs-on: ubuntu-24.04 |
| 12 |
steps: |
| 13 |
- name: Disable AppArmor restriction for bubblewrap |
| 14 |
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 |
| 15 |
|
| 16 |
- name: Checkout code |
| 17 |
uses: actions/checkout@v2 |
| 18 |
# BuildStream requires tags to be able to find its version. |
| 19 |
with: |
| 20 |
fetch-depth: 0 |
| 21 |
|
| 22 |
- name: Give `testuser` ownership of the source directory |
| 23 |
run: sudo chown -R 1000:1000 ${GITHUB_WORKSPACE} |
| 24 |
|
| 25 |
- name: Build documentation using Docker Compose |
| 26 |
run: | |
| 27 |
${GITHUB_WORKSPACE}/.github/run-ci.sh docs |
| 28 |
|
| 29 |
# Restore permissions to the current user |
| 30 |
sudo chown -R ${USER} ${GITHUB_WORKSPACE} |
| 31 |
|
| 32 |
# Include a tarball in the published docs, allowing for |
| 33 |
# easy re-publishing of master docs on docs.buildstream.build |
| 34 |
tar -C doc/build/html -zcf docs.tgz . |
| 35 |
|
| 36 |
- name: Upload artifacts |
| 37 |
uses: actions/upload-artifact@v4 |
| 38 |
with: |
| 39 |
name: docs |
| 40 |
path: | |
| 41 |
doc/build/html |
| 42 |
docs.tgz |
| 43 |
|
| 44 |
publish: |
| 45 |
needs: build |
| 46 |
runs-on: ubuntu-24.04 |
| 47 |
steps: |
| 48 |
|
| 49 |
- name: Disable AppArmor restriction for bubblewrap |
| 50 |
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 |
| 51 |
|
| 52 |
- name: Download artifact |
| 53 |
uses: actions/download-artifact@v4 |
| 54 |
with: |
| 55 |
name: docs |
| 56 |
path: docs |
| 57 |
|
| 58 |
- name: Checkout code |
| 59 |
uses: actions/checkout@v2 |
| 60 |
with: |
| 61 |
ref: gh-pages |
| 62 |
path: pages |
| 63 |
fetch-depth: 0 |
| 64 |
|
| 65 |
- name: Update repo |
| 66 |
run: | |
| 67 |
|
| 68 |
# First reset the branch state to the initial commit, this ensures that |
| 69 |
# we do not pollute the repository with the history of every docs package |
| 70 |
# we've ever published (history of docs packages for major releases is |
| 71 |
# also stored as GitHub release assets) |
| 72 |
# |
| 73 |
cd pages/ |
| 74 |
git reset --hard GH_PAGES_FIRST_COMMIT |
| 75 |
mkdir docs |
| 76 |
# Copy the docs asset over and overwrite the orphan gh-pages branch, ensure |
| 77 |
# that we disable GitHub's jekyll by creating the .nojekyll file, otherwise |
| 78 |
# it will interfere with the rendering of the site. |
| 79 |
# |
| 80 |
cp -a ../docs/doc/build/html/* docs |
| 81 |
cp -a ../docs/docs.tgz docs |
| 82 |
touch .nojekyll |
| 83 |
touch docs/.nojekyll |
| 84 |
|
| 85 |
git add . |
| 86 |
git config --local user.email "merge-ci@ponyland" |
| 87 |
git config --local user.name "Github Actions Nightly Job" |
| 88 |
git commit -m "Update repo for docs build $GITHUB_RUN_NUMBER" |
| 89 |
git push --force "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" gh-pages |