Update Documentation #4
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: Update Documentation | |
| on: [workflow_dispatch] | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Get source code version number | |
| id: gitversion | |
| run: echo "version=$(grep -o "versionString = [^, ;]*" src/main/java/com/fazecast/jSerialComm/SerialPort.java | grep -o "\".*\"" | grep -o [^\"].*[^\"])" >> $GITHUB_OUTPUT | |
| - name: Set up Java build environment | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '11' | |
| cache: maven | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: SIGN_KEY_PASS | |
| - name: Build library documentation using Maven | |
| run: ./mvnw versions:set -DnewVersion=${{ steps.gitversion.outputs.version }} && ./mvnw clean javadoc:javadoc | |
| - name: Check out existing library documentation | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| path: documentation | |
| - name: Update Javadoc library documentation | |
| run: rm -rf documentation/binaries/* documentation/javadoc && mv target/javadoc/apidocs documentation/javadoc && sed -i "s@maven2/com/fazecast/jSerialComm/[^\"]*@maven2/com/fazecast/jSerialComm/${{ steps.gitversion.outputs.version }}/jSerialComm-${{ steps.gitversion.outputs.version }}.jar@g" documentation/index.html | |
| - name: Publish new library documentation | |
| uses: s0/git-publish-subdir-action@develop | |
| env: | |
| REPO: self | |
| BRANCH: gh-pages | |
| FOLDER: documentation | |
| GITHUB_TOKEN: ${{ secrets.GRADLE_UPDATE_PAT }} | |
| MESSAGE: "Updated docs to v${{ steps.gitversion.outputs.version }}" |