From f03083d7534209ad94dc3c4d7afd17f58e58127d Mon Sep 17 00:00:00 2001 From: vmishenev Date: Wed, 28 Jul 2021 14:57:38 +0300 Subject: Migrate Dokka examples to Dokka repo (KT-47798) (#2030) * Migrate Dokka examples to Dokka repo (KT-47798) * Configure workflow of examples checking * Add workflow to deploy examples --- .github/workflows/dokka-examples.yml | 119 ++++++++++++++++++++++++++++++++ .github/workflows/gh-pages-examples.yml | 59 ++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 .github/workflows/dokka-examples.yml create mode 100644 .github/workflows/gh-pages-examples.yml (limited to '.github/workflows') diff --git a/.github/workflows/dokka-examples.yml b/.github/workflows/dokka-examples.yml new file mode 100644 index 00000000..35fc5f92 --- /dev/null +++ b/.github/workflows/dokka-examples.yml @@ -0,0 +1,119 @@ +name: Build examples + +on: pull_request + +jobs: + build: + strategy: + matrix: + projects: [ + examples/gradle/dokka-gradle-example, + examples/gradle/dokka-kotlinAsJava-example, + examples/gradle/dokka-library-publishing-example, + examples/gradle/dokka-multimodule-example, + examples/gradle/dokka-multiplatform-example, + examples/gradle/dokka-customFormat-example + ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + examples_changed: + - '${{ matrix.projects }}/**' + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: ./gradlew build --no-daemon --stacktrace + working-directory: ${{ matrix.projects }} + if: steps.filter.outputs.examples_changed == 'true' + + run-dokka-html: + strategy: + matrix: + projects: [ + examples/gradle/dokka-gradle-example, + examples/gradle/dokka-kotlinAsJava-example, + examples/gradle/dokka-library-publishing-example, + examples/gradle/dokka-multiplatform-example, + examples/gradle/dokka-customFormat-example + ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + examples_changed: + - '${{ matrix.projects }}/**' + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: ./gradlew dokkaHtml --no-daemon --stacktrace + working-directory: ${{ matrix.projects }} + if: steps.filter.outputs.examples_changed == 'true' + + run-dokka-publishing: + strategy: + matrix: + tasks: [dokkaJavadocJar, dokkaHtmlJar] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + examples_changed: + - 'examples/gradle/dokka-library-publishing-example/**' + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: ./gradlew ${{ matrix.tasks }} --no-daemon --stacktrace + working-directory: examples/gradle/dokka-library-publishing-example + if: steps.filter.outputs.examples_changed == 'true' + + run-dokka-gradle-tasks: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - task: "dokkaCustomFormat" + dir: "examples/gradle/dokka-customFormat-example" + - task: "dokkaHtmlMultiModule" + dir: "examples/gradle/dokka-multimodule-example" + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + examples_changed: + - '${{ matrix.dir }}/**' + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: ./gradlew ${{ matrix.task }} --no-daemon --stacktrace + working-directory: ${{ matrix.dir }} + if: steps.filter.outputs.examples_changed == 'true' + + run-dokka-maven-example: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + examples_changed: + - 'examples/maven/**' + working-directory: examples/maven + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: mvn compile dokka:dokka + working-directory: examples/maven + if: steps.filter.outputs.examples_changed == 'true' \ No newline at end of file diff --git a/.github/workflows/gh-pages-examples.yml b/.github/workflows/gh-pages-examples.yml new file mode 100644 index 00000000..1931aaa7 --- /dev/null +++ b/.github/workflows/gh-pages-examples.yml @@ -0,0 +1,59 @@ +name: Build and deploy examples to GitHub Pages + +on: + push: + branches: + - master +jobs: + build-examples: + runs-on: ubuntu-latest + strategy: + matrix: + projects: [ + dokka-gradle-example, + dokka-kotlinAsJava-example, + dokka-library-publishing-example, + dokka-multiplatform-example, + dokka-customFormat-example + ] + steps: + - name: Checkout dokka + uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + examples_changed: + - 'examples/gradle/${{ matrix.projects }}/**' + + - uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Build html + run: ./gradlew dokkaHtml --no-daemon --stacktrace + working-directory: examples/gradle/${{ matrix.projects }} + if: steps.filter.outputs.examples_changed == 'true' + + - name: Upload artifact + uses: actions/upload-artifact@v2 + if: steps.filter.outputs.examples_changed == 'true' + with: + name: ${{ matrix.projects }} + path: examples/gradle/${{ matrix.projects }}/build/dokka + + + deploy-examples: + runs-on: ubuntu-latest + needs: build-examples + steps: + - uses: actions/download-artifact@v2 + with: + path: public/examples + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + keep_files: true + publish_dir: ./public + full_commit_message: Publish examples \ No newline at end of file -- cgit