publish-docs-tagged #2
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: Compile documentation (tagged release) | |
on: | |
repository_dispatch: | |
types: [publish-docs-tagged] | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
env: | |
TAG: ${{ github.event.client_payload.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: pages | |
fetch-depth: 0 | |
- uses: actions/checkout@v4 | |
with: | |
repository: Jelly-RDF/jelly-protobuf | |
path: proto | |
ref: ${{ github.event.client_payload.tag }} | |
- id: jvm_release | |
uses: pozetroninc/[email protected] | |
with: | |
owner: Jelly-RDF | |
repo: jelly-jvm | |
excludes: prerelease, draft | |
- name: Generate Protobuf reference | |
run: | | |
mkdir -p pages/docs/specification/proto | |
cp proto/*.proto pages/docs/specification/proto | |
# Remove double newlines in comments to avoid breaking markdown tables | |
# See: https://github.com/pseudomuto/protoc-gen-doc/issues/274 | |
find proto/*.proto -type f -exec perl -0777 -i -pe "s|\n[ \t]+//[ \t]*\n|\n|igs" {} \; | |
find proto/*.proto -type f -exec perl -0777 -i -pe "s|(https?[^\s]+)|[\1](\1)|igs" {} \; | |
docker run --rm -v $(pwd)/proto:/protos -v $(pwd)/pages/docs/specification:/out pseudomuto/protoc-gen-doc --doc_opt=markdown,reference.md | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
cache-dependency-path: 'pages/requirements.txt' | |
- name: Install dependencies | |
working-directory: ./pages | |
run: pip install -r requirements.txt | |
- name: Deploy site | |
working-directory: ./pages | |
run: | | |
export JVM_TAG='${{ steps.jvm_release.outputs.release }}' | |
export PROTO_PATH='../proto' | |
git fetch origin gh-pages --depth=1 | |
git config user.name ci-bot | |
git config user.email [email protected] | |
V_MAJOR=`echo ${TAG#v} | awk -F '.' '{print $1}'` | |
V_MINOR=`echo ${TAG#v} | awk -F '.' '{print $2}'` | |
mike deploy --push --alias-type=redirect --update-aliases "${V_MAJOR}.${V_MINOR}.x" stable "${TAG#v}" |