diff --git a/.github/actions/publish_pages/action.yml b/.github/actions/publish_pages/action.yml new file mode 100644 index 000000000..a8b29c2a2 --- /dev/null +++ b/.github/actions/publish_pages/action.yml @@ -0,0 +1,32 @@ +name: Publish Page Action + +inputs: + target: + required: true + type: string + base_path: + required: true + type: string + +runs: + steps: + - name: Build DocC + shell: bash + 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 + shell: bash + uses: actions/upload-pages-artifact@v1 + with: + path: 'docs' + - name: Deploy to GitHub Pages + shell: bash + 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..21fa72940 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,19 @@ 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