name: Publish Documentation to BookStack permissions: contents: read on: workflow_dispatch: push: branches: - main paths: - 'README.md' - 'docs/installationsanleitung.md' - 'docs/systemvoraussetzungen.md' jobs: publish_docs: runs-on: ubuntu-latest strategy: # Buecher nacheinander publizieren: bei workflow_dispatch (alle Beine) bzw. Pushes mit # mehreren geaenderten Docs ueberlastet paralleles Publizieren die BookStack-API # (HTTP 429 Too Many Requests). Analog MesoArchivWeb/documentation.yml. fail-fast: false max-parallel: 1 matrix: include: - file: README.md book-name: 'MESO AIBE' instance-id: 'mesoaibe-docs' - file: docs/installationsanleitung.md book-name: 'MESO AIBE Installation' instance-id: 'mesoaibe-installation-docs' - file: docs/systemvoraussetzungen.md book-name: 'MESO AIBE Systemvoraussetzungen' instance-id: 'mesoaibe-systemvoraussetzungen-docs' steps: - name: Checkout repository uses: actions/checkout@v4 with: # Volle Historie noetig, damit "git diff .." funktioniert. Mit # fetch-depth: 1 (Default) kennt der Runner github.event.before nicht # -> git diff schlaegt fehl -> changed=false -> Publish wird uebersprungen. fetch-depth: 0 - name: Check if file changed id: changed run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "changed=true" >> "$GITHUB_OUTPUT" elif git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^${{ matrix.file }}$'; then echo "changed=true" >> "$GITHUB_OUTPUT" else echo "changed=false" >> "$GITHUB_OUTPUT" fi - name: Publish to BookStack if: steps.changed.outputs.changed == 'true' uses: CSS-EDV-Support/.github/actions/publish-bookstack@main with: book-name: ${{ matrix.book-name }} product-tag: 'MESO AIBE' instance-id: ${{ matrix.instance-id }} readme-path: ${{ matrix.file }} bookstack-url: ${{ secrets.BOOKSTACK_URL }} bookstack-token-id: ${{ secrets.BOOKSTACK_TOKEN_ID }} bookstack-token-secret: ${{ secrets.BOOKSTACK_TOKEN_SECRET }} # Mappt Cross-MD-Links zwischen den publizierten Buechern auf # BookStack-Buch-URLs. Jeder Eintrag: dateiname = Book Name. link-map: | README.md = MESO AIBE docs/installationsanleitung.md = MESO AIBE Installation docs/systemvoraussetzungen.md = MESO AIBE Systemvoraussetzungen