name: Python Build on: push: branches: - master paths: - ".github/workflows/python-build-pages.yml" - "metadata-ingestion/**" - "metadata-ingestion-modules/**" - "metadata-models/**" pull_request_target: branches: - "**" paths: - ".github/workflows/python-build-pages.yml" - "metadata-ingestion/**" - "metadata-ingestion-modules/**" - "metadata-models/**" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: deploy-pages: runs-on: ubuntu-latest if: ${{ vars.CLOUDFLARE_WHEELS_PROJECT_NAME != '' }} name: Python Wheels permissions: contents: read pull-requests: read deployments: write steps: - name: Set up JDK 17 uses: actions/setup-java@v4 with: distribution: "zulu" java-version: 17 - uses: gradle/actions/setup-gradle@v4 - uses: actions/checkout@v4 # Note: not using acryldata/sane-checkout-action because this is a # pull_request_target event, and hence requires `ref`. with: ref: ${{ github.event.pull_request.head.sha }} - uses: actions/setup-python@v5 with: python-version: "3.10" cache: "pip" - uses: actions/cache@v4 with: path: | ~/.cache/uv key: ${{ runner.os }}-uv-${{ hashFiles('**/requirements.txt') }} - name: Build Python wheel site run: | ./gradlew :python-build:buildSite env: GITHUB_TOKEN: ${{ github.token }} - name: Publish # Cloudflare's pages-action does not support PRs from forks. # See https://developers.cloudflare.com/pages/platform/known-issues/ # Based on the discussion here https://github.com/json-schema-org/website/issues/330 # we can use a direct upload to work around this limitation. # See https://github.com/AdrianGonz97/refined-cf-pages-action#enabling-pr-previews-from-forks uses: AdrianGonz97/refined-cf-pages-action@v1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: ${{ vars.CLOUDFLARE_WHEELS_PROJECT_NAME }} deploymentName: ${{ vars.CLOUDFLARE_WHEELS_PROJECT_NAME }} workingDirectory: python-build directory: site gitHubToken: ${{ github.token }}