The following is a quick recipe to public a Maven site to GitHub pages
name: publish on: [push] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v1 - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Maven run: mvn -B site - name: Move site to root directory run: mv target/site/* . - name: Checkout gh-pages branch uses: actions/checkout@v1 with: ref: 'gh-pages' clean: 'false' - name: Commit to GitHub pages env: PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }} PUBLISH_USERNAME: ${{ secrets.PUBLISH_USERNAME }} run: | git config --global user.email "noreply@noreply.com" git config --global user.name "Automated job" git add . git commit -a -m "Publishing to GitHub pages" git push https://${PUBLISH_USERNAME}:${PUBLISH_PASSWORD}@github.com/user/repository.git
Adjust the user and repository in the git push command. Adjust the email address in the git config command. Add the PUBLISH_USERNAME secret as a secret to your GitHub account. Add the PUBLISH_PASSWORD secret as a secret to your GitHub account.
Posted June 24th, 2021