From c98959093ef85cac97e40e7b211c968ad0985f45 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Mon, 29 Apr 2024 19:29:13 +0400 Subject: [PATCH] Implement the `publish-pages.yml` action --- .github/actions/publish_pages/action.yml | 31 +++++++++++++++++++++ .github/workflows/publish-pages.yml | 35 ++++++++++++------------ 2 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 .github/actions/publish_pages/action.yml diff --git a/.github/actions/publish_pages/action.yml b/.github/actions/publish_pages/action.yml new file mode 100644 index 000000000..dd703e16c --- /dev/null +++ b/.github/actions/publish_pages/action.yml @@ -0,0 +1,31 @@ +name: Publish Page Action + +inputs: + target: + required: true + type: string + base_path: + required: true + type: string + +runs: + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + - name: Build DocC + run: | + swift build; + swift package \ + --allow-writing-to-directory ./docs \ + generate-documentation \ + --target ${{ inputs.target }} \ + --output-path ./docs \ + --transform-for-static-hosting \ + --hosting-base-path ${{ inputs.base_path }}; + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: 'docs' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.github/workflows/publish-pages.yml b/.github/workflows/publish-pages.yml index c5e2c6c7f..aeb3d1340 100644 --- a/.github/workflows/publish-pages.yml +++ b/.github/workflows/publish-pages.yml @@ -4,6 +4,11 @@ on: push: branches: - main + - dev + pull_request: + branches: + - main + - dev permissions: contents: read @@ -20,23 +25,17 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: macos-12 + strategy: + fail-fast: false + matrix: + include: + - target: "Flare" + base_path: "flare" + - destination: "FlareUI" + base_path: "flareui" steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Build DocC - run: | - swift build; - swift package \ - --allow-writing-to-directory ./docs \ - generate-documentation \ - --target Flare \ - --output-path ./docs \ - --transform-for-static-hosting \ - --hosting-base-path flare; - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 + - name: ${{ matrix.target }} DocC + uses: ./.github/actions/publish_pages with: - path: 'docs' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 \ No newline at end of file + target: ${{ matrix.target }} + base_path: ${{ matrix.base_path }} \ No newline at end of file