1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
name: Document
on:
push:
branches:
- '**'
- '!dependabot/**'
tags:
- '**'
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler-cache: true
- name: Install requirements
run: |
bundle exec ruby extconf.rb
make -j$(nproc)
make install
- name: Generate document
run: |
GI_GIR_PATH=/usr/share/gir-1.0 \
bundle exec rake -m doc:generate
find yard_docs \
-name '*.html' \
-exec sed -i -e 's/Generated on .* by/Generated by/g' '{}' ';'
case ${GITHUB_REF} in
refs/tags/*)
version=${GITHUB_REF##refs/tags}
;;
*)
version=dev
;;
esac
mkdir -p public/doc
rm -rf public/doc/${version}
mv yard_docs public/doc/${version}
if [ "${version}" != "dev" ]; then
rm -rf public/doc/latest
cp -a public/doc/${version} public/doc/latest
fi
- name: Publish Documentation on GitHub Pages
if: github.event_name == 'push' && github.ref_name == 'main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: true
# We can use this with v4
# force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
|