diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index 54ed16f..fa43243 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - build/test-deployment-of-versions permissions: contents: write @@ -23,7 +24,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: @@ -37,37 +38,39 @@ jobs: - name: Build documentation run: ./gradlew dokkaHtml + - name: Set env.VERSION from json + run: | + echo "VERSION=$(cat ./build/dokka/html/version.json | jq -r '.version')" >> "$GITHUB_ENV" + - uses: actions/configure-pages@v3 + if: ${{ !contains(env.VERSION, '-SNAPSHOT') }} - uses: actions/upload-pages-artifact@v1 + if: ${{ !contains(env.VERSION, '-SNAPSHOT') }} with: path: 'build/dokka/html' - - name: Deploy to Documentation GitHub Pages + - uses: actions/deploy-pages@v2 + if: ${{ !contains(env.VERSION, '-SNAPSHOT') }} id: deployment - uses: actions/deploy-pages@v1 - - name: Delete directory ./build/dokka/html/older - run: rm -Rf ./build/dokka/html/older - - - name: Set VERSION from json + - name: Cleanup, archive and commit documenation + if: ${{ !contains(env.VERSION, '-SNAPSHOT') }} run: | - echo "VERSION=$(cat ./build/dokka/html/version.json | jq -r '.version')" >> "$GITHUB_ENV" + rm -Rf ./build/dokka/html/older - - name: Archive documentation - run: | + # Archive documentation rm -Rf "./documentation/${{env.VERSION}}" mv ./build/dokka/html "./documentation/${{env.VERSION}}" rm -Rf ./documentation/*-SNAPSHOT - - name: Commit documentation - run: | - # setup the username and email + # Commit documentation + + ## setup the username and email git config user.name "GitHub Actions" git config user.email "<>" - - # Stage the file, commit and push + + ## Stage the file, commit and push git add documentation git commit -m "[ci-commit] [documentation] updated documentation for ${{env.VERSION}}" || true git push origin master -