diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 0000000..5ba4276 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,58 @@ +name: Deploy Docs + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + name: Build + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Build Docs + run: | + xcodebuild docbuild \ + -scheme PowerSync \ + -destination 'platform=macOS' \ + -derivedDataPath ./DerivedData \ + -configuration Release + + - name: Process Docs + run: | + xcrun docc process-archive \ + transform-for-static-hosting \ + ./DerivedData/Build/Products/Release/PowerSync.doccarchive/ \ + --output-path ./docs-site \ + --hosting-base-path /powersync-swift + + # The Docs are available at the path mentioned below. We can override the index.html to automatically redirect to the documentation page. + - name: Prepare static files + run: | + echo '' > ./docs-site/index.html + + - name: Upload static files as artifact + id: deployment + uses: actions/upload-pages-artifact@v3 + with: + path: docs-site + outputs: + page_url: ${{ steps.deployment.outputs.page_url }} + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ needs.build.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4