diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9fa316..bb6e3d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,16 +2,19 @@ name: CI on: push: - branches: - - main + branches: [ 'main' ] pull_request: - branches: - - main + branches: [ 'main' ] + +permissions: {} jobs: - asciidoctor: - name: "Asciidoctor" + + build-user-guide: + + name: Build User Guide runs-on: ubuntu-latest + steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up JDK 11 @@ -20,12 +23,30 @@ jobs: distribution: 'zulu' java-version: 11 cache: 'gradle' - - name: Run Asciidoctor + - name: Build User Guide run: ./gradlew asciidoctor - - name: Publish to GitHub Pages - if: github.repository == 'assertj/doc' && github.event_name == 'push' - run: ./gradlew --stacktrace --info gitPublishPush - env: - GIT_COMMITTER_NAME: GitHub Actions - GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com - GRGIT_USER: ${{ secrets.ASCIIDOCTOR_TOKEN }} + - name: Upload User Guide Artifact + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 + with: + path: build/docs/asciidoc/user-guide + + deploy-user-guide: + + name: Deploy User Guide + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: build-user-guide + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + concurrency: + group: github-pages + cancel-in-progress: true + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5