Skip to content

Commit

Permalink
Use Actions to build docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rdipardo committed May 29, 2024
1 parent e9d3f06 commit 4da1236
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/fpdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ name: Publish Docs

on:
push:
branches:
- api
paths:
- 'docs/**'
- '.github/workflows/fpdocs.yml'

permissions:
contents: read
pages: write
id-token: write

env:
LAZARUS_VERSION: '3.2'

jobs:
deploy:
environment:
Expand All @@ -24,12 +28,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore Lazarus packages
id: lazarus-deb-cache
uses: actions/cache@v4
with:
path: '/tmp/lazarus-src'
key: lazarus-${{ env.LAZARUS_VERSION }}-${{ runner.os }}
- name: Install Lazarus ${{ env.LAZARUS_VERSION }}
run: |
curl -sSL https://bitbucket.org/rdipardo/lazarus-orb/raw/alpha/src/scripts/install_lazarus.sh | bash
env:
# https://askubuntu.com/a/1421221
NEEDRESTART_MODE: l
DEBIAN_FRONTEND: noninteractive
- name: Generate docs
run: |
sudo chown -R $USER /usr/share/lazarus
docs/build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.'
path: './docs/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
9 changes: 3 additions & 6 deletions docs/build
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
#
set -e
cd "$(dirname "$0")"
if [ -n "$PUBLISH_DOCS" ] && [ ! -d './html' ]; then
git clone --depth=1 -b api [email protected]:rdipardo/fpgeanyplugin.git ./html
else
mkdir -p ./html
fi
mkdir -p ./html
_get_unit_path() {
dirname "$(lazbuild --verbose-pkgsearch __phony__.lpr | awk -F '\"' "BEGIN{IGNORECASE=1}/$1.*Success/{print \$2}")";
}
Expand All @@ -40,7 +36,8 @@ done
find ./html -maxdepth 1 -type f -iname \*.html -exec sed -i '/\[<a href=\"index-[8-9].html\".*a>\]/d' {} +
find ./html -type f -iname fpdoc.css -exec dirname {} \; -exec cp ./fpdoc.css {} \;
cp favicon.ico ./html 2>/dev/null
touch ./html/.nojekyll
[ -d './html/.git' ] && \
cp -r ../.github/ ./html && \
[ "$(git --git-dir=./html/.git --work-tree=./html/ status -s | grep -cE "[ADM(\?\?)]")" -ne 0 ] && \
cd ./html && git add . && git commit
exit 0
6 changes: 6 additions & 0 deletions docs/scaffold.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ esac
[ ! -d "$SRC_PATH" ] && echo "Invalid unit path: '$SRC_PATH'" && exit 2
for unit in "${UNITS[@]}"; do
echo -e "\nExtracting symbols from ${unit%%.*} ..."
# FPDoc - Free Pascal Documentation Tool
# Version 3.2.2 [2021/07/09]
# ...
# Expected "Identifier" at token "file" in file .../lazglib2.pas at line 1495 column 12.
[ -n "$GITHUB_ACTIONS" ] && [ "$unit" == 'lazglib2.pas' ] && \
sed -i 's/\^\(file;\)/\^\&\1/' "$SRC_PATH/$unit"
makeskel --disable-private --disable-arguments --disable-errors \
--package="$1" --input="$DEFINES $SRC_PATH/$unit" \
--output="$1/units/${unit%%.*}.xml" 1>/dev/null
Expand Down

0 comments on commit 4da1236

Please sign in to comment.