Build documentation from sources #11
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: Zola on GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
env: | |
LATEST_VERSION: 3.0.18 | |
jobs: | |
build: | |
name: Publish site | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Replace version name | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
sed -i "s#v0\.19\.2#${{ env.LATEST_VERSION }}#g" content/_index.md | |
export GITHUB_PAGES_URL=$(gh api "repos/${{ github.repository }}/pages" --jq '.html_url') | |
sed -i "s#https:\/\/libical\.github\.io#${GITHUB_PAGES_URL}#g" config.toml | |
export GITHUB_CODE_WEBSITE="${{ github.server_url }}/${{ github.repository }}" | |
sed -i "s#https:\/\/github.com\/libical\/io.github.libical#${GITHUB_CODE_WEBSITE}#g" config.toml | |
- name: Build website | |
uses: shalzz/zola-deploy-action@v0.19.2 | |
env: | |
BUILD_ONLY: true | |
- name: Checkout libical v${{ env.LATEST_VERSION }} | |
uses: actions/checkout@v4 | |
with: | |
repository: libical/libical | |
ref: v${{ env.LATEST_VERSION }} | |
path: libical-sources | |
- name: Install dependencies | |
run: sudo apt-get -y install gtk-doc-tools xml-core libdb-dev gobject-introspection libgirepository1.0-dev cmake ninja-build doxygen graphviz | |
- name: Configure libical | |
run: | | |
cd libical-sources | |
mkdir build | |
cmake -B build -G Ninja -DENABLE_GTK_DOC=True -DICAL_GLIB=True -DGOBJECT_INTROSPECTION=True -DICAL_BUILD_DOCS=True | |
- name: Build libical documentation | |
run: | | |
cd libical-sources | |
cmake --build build --target docs | |
- name: Move Documentation | |
run: | | |
sudo rm -R public/docs/developer/libical | |
sudo mv libical-sources/build/apidocs/html public/docs/developer/libical | |
sudo rm -R public/docs/developer/libical-glib | |
sudo mv public/libical-glib public/docs/developer/libical-glib | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# upload entire directory | |
path: 'public' | |
deploy: | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{steps.deployment.outputs.page_url}} | |
steps: | |
- name: Deploy artifact | |
id: deployment | |
uses: actions/deploy-pages@v4 |