|
| 1 | +name: Build HTML Pages and publish to rtos-docs-html |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: run-${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +env: |
| 13 | + SOURCE_REPO: 'eclipse-threadx/rtos-docs-asciidoc' |
| 14 | + TARGET_REPO: 'eclipse-threadx/rtos-docs-html' |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + if: github.repository == '${{ env.SOURCE_REPO }}' |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 22 | + with: |
| 23 | + persist-credentials: false |
| 24 | + path: 'asciidoc' |
| 25 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 26 | + with: |
| 27 | + repository: ${{ env.TARGET_REPO }} |
| 28 | + ref: 'main' |
| 29 | + path: 'html' |
| 30 | + token: ${{ secrets.DOCS_PUBLISH_TOKEN }} |
| 31 | + - uses: ruby/setup-ruby@d781c1b4ed31764801bfae177617bb0446f5ef8d # v1.218.0 |
| 32 | + with: |
| 33 | + ruby-version: 3.4.1 |
| 34 | + - uses: reitzig/actions-asciidoctor@c642db5eedd1d729bb8c92034770d0b2f769eda6 # v2.0.2 |
| 35 | + with: |
| 36 | + version: 2.0.23 |
| 37 | + - name: build html pages |
| 38 | + run: | |
| 39 | + DESTINATION="${{ github.workspace }}/html" |
| 40 | + cd asciidoc/rtos-docs |
| 41 | + for directory in `ls -d */`; do |
| 42 | + if [ "${directory}" != "media/" ]; then |
| 43 | + echo "${directory}" |
| 44 | + CURRENT_DESTINATION=${DESTINATION}/${directory} |
| 45 | + mkdir -p ${CURRENT_DESTINATION} |
| 46 | + (cd "${directory}" && asciidoctor *.adoc --destination-dir=${CURRENT_DESTINATION}) |
| 47 | + if [ -d "${directory}/media" ]; then |
| 48 | + (cd "${directory}" && cp -R media ${CURRENT_DESTINATION}) |
| 49 | + fi |
| 50 | + fi |
| 51 | + done |
| 52 | + - name: push to rtos-docs-html |
| 53 | + run: | |
| 54 | + cd "${{ github.workspace }}/html" |
| 55 | +
|
| 56 | + git config user.name "eclipse-threadx-bot" |
| 57 | + git config user.email "<threadx-bot@eclipse.org>" |
| 58 | + |
| 59 | + COMMIT_MESSAGE="Publish generated html pages from ${{ github.repository }}/${{ github.ref }}@${{ github.sha }}" |
| 60 | + git add . |
| 61 | + git commit -m "${COMMIT_MESSAGE}" |
| 62 | + git push origin |
0 commit comments