Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix triggers for docs deployment #12159

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/docs-global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
- docs/**
- mkdocs.yml
- .github/workflows/docs-global.yml
push:
tags:
- py-**
repository_dispatch:
types:
- python-release
# Allow manual trigger until we have properly versioned docs
workflow_dispatch:

Expand All @@ -17,6 +17,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.sha }}
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: docs/mlc-config.json
Expand All @@ -26,6 +28,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.sha }}
- uses: psf/black@stable
with:
src: docs/src/python
Expand All @@ -35,6 +39,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.sha }}

- name: Set up Python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -75,12 +81,12 @@ jobs:
run: mkdocs build

- name: Add .nojekyll
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch'
working-directory: site
run: touch .nojekyll

- name: Deploy docs
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/docs-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ on:
- py-polars/docs/**
- py-polars/polars/**
- .github/workflows/docs-python.yml
tags:
- py-**
repository_dispatch:
types:
- python-release

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -24,6 +25,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.sha }}

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -40,7 +43,7 @@ jobs:
working-directory: py-polars/docs
env:
SPHINXOPTS: -W --jobs=auto
POLARS_VERSION: ${{ github.ref_name }}
POLARS_VERSION: ${{ github.event.client_payload.tag }}
run: make html

- name: Deploy Python docs for latest development version
Expand All @@ -53,25 +56,25 @@ jobs:

- name: Parse the tag to find the major/minor version of Polars
id: version
if: ${{ github.ref_type == 'tag' }}
if: github.event_name == 'repository_dispatch'
shell: bash
run: |
tag="${{ github.ref_name }}"
tag="${{ github.event.client_payload.tag }}"
regex="py-([0-9]+\.[0-9]+)\.[0-9]+.*"
[[ $tag =~ $regex ]]
version=${BASH_REMATCH[1]}
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Deploy Python docs for latest release version - versioned
if: ${{ github.ref_type == 'tag' }}
if: github.event_name == 'repository_dispatch'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: py-polars/docs/build/html
target-folder: docs/python/version/${{ steps.version.outputs.version }}
single-commit: true

- name: Deploy Python docs for latest release version - stable
if: ${{ github.ref_type == 'tag' }}
if: github.event_name == 'repository_dispatch'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: py-polars/docs/build/html
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.github-release.outputs.tag_name }}

- name: Trigger other workflows related to the release
if: inputs.dry-run == false && steps.version.outputs.is_prerelease == false
uses: peter-evans/repository-dispatch@v2
with:
event-type: python-release
client-payload: >
{
"version": "${{ steps.version.outputs.version }}",
"tag": "${{ steps.github-release.outputs.tag_name }}",
"sha": "${{ inputs.sha || github.sha }}"
}