Skip to content

Commit

Permalink
Merge pull request #4 from netomi/add-automation
Browse files Browse the repository at this point in the history
Add automation workflow to documentation pages
  • Loading branch information
fdesbiens authored Feb 7, 2025
2 parents 59a326a + bfa8d4b commit 4fa5bed
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build HTML Pages and publish to rtos-docs-html

on:
push:
branches:
- main

concurrency:
group: run-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

env:
SOURCE_REPO: 'eclipse-threadx/rtos-docs-asciidoc'
TARGET_REPO: 'eclipse-threadx/rtos-docs-html'

jobs:
build:
if: github.repository == '${{ env.SOURCE_REPO }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: 'asciidoc'
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ env.TARGET_REPO }}
ref: 'main'
path: 'html'
token: ${{ secrets.DOCS_PUBLISH_TOKEN }}
- uses: ruby/setup-ruby@d781c1b4ed31764801bfae177617bb0446f5ef8d # v1.218.0
with:
ruby-version: 3.4.1
- uses: reitzig/actions-asciidoctor@c642db5eedd1d729bb8c92034770d0b2f769eda6 # v2.0.2
with:
version: 2.0.23
- name: build html pages
run: |
DESTINATION="${{ github.workspace }}/html"
cd asciidoc/rtos-docs
for directory in `ls -d */`; do
if [ "${directory}" != "media/" ]; then
echo "${directory}"
CURRENT_DESTINATION=${DESTINATION}/${directory}
mkdir -p ${CURRENT_DESTINATION}
(cd "${directory}" && asciidoctor *.adoc --destination-dir=${CURRENT_DESTINATION})
if [ -d "${directory}/media" ]; then
(cd "${directory}" && cp -R media ${CURRENT_DESTINATION})
fi
fi
done
- name: push to rtos-docs-html
run: |
cd "${{ github.workspace }}/html"
git config user.name "eclipse-threadx-bot"
git config user.email "<[email protected]>"
COMMIT_MESSAGE="Publish generated html pages from ${{ github.repository }}/${{ github.ref }}@${{ github.sha }}"
git add .
git commit -m "${COMMIT_MESSAGE}"
git push origin

0 comments on commit 4fa5bed

Please sign in to comment.