Added workflow_dispatch trigger with main guard #8
This file contains hidden or 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: Build HTML Pages and publish to rtos-docs-html | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| - '!main' | |
| workflow_dispatch: | |
| concurrency: | |
| group: run-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| TARGET_REPO: 'eclipse-threadx/rtos-docs-html' | |
| jobs: | |
| build: | |
| if: > | |
| github.repository == 'eclipse-threadx/rtos-docs-asciidoc' && | |
| github.ref_name != 'main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| path: 'asciidoc' | |
| - name: Checkout external HTML repository | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ env.TARGET_REPO }} | |
| ref: 'main' | |
| path: 'rtos-docs-html' | |
| token: ${{ secrets.DOCS_PUBLISH_TOKEN }} | |
| - name: Install Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: '18' | |
| - name: Install Antora | |
| run: npm i antora | |
| working-directory: ./asciidoc | |
| - name: Generate Site | |
| run: npx antora antora-playbook.yml | |
| working-directory: ./asciidoc | |
| - name: push to rtos-docs-html | |
| run: | | |
| cd "${{ github.workspace }}/rtos-docs-html" | |
| git checkout -B ${{ github.ref_name }} | |
| git config user.name "eclipse-threadx-bot" | |
| git config user.email "<threadx-bot@eclipse.org>" | |
| COMMIT_MESSAGE="Publish generated html pages from ${{ github.repository }}/${{ github.ref }}@${{ github.sha }}" | |
| git add . | |
| git commit -m "${COMMIT_MESSAGE}" | |
| git push origin |