Skip to content
Merged
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
31 changes: 27 additions & 4 deletions .github/workflows/docbuild-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,33 @@ jobs:
steps:
- name: Set pandas version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "PANDAS_VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_ENV"
# tags include a `v` prefix.
tag_version_pat="^v\d+\.\d+\.\d+(rc\d+)?$"
version_pat="^\d+\.\d+\.\d+(rc\d+)?$"

if [[ -n "${{ github.event.inputs.version }}" ]]; then
PANDAS_VERSION="${{ github.event.inputs.version }}"
elif [[ "${{ github.event_name }}" == "push" && "$GITHUB_REF_NAME" =~ $tag_version_pat ]]; then
PANDAS_VERSION="${GITHUB_REF_NAME:1}"
else
echo "PANDAS_VERSION=${GITHUB_REF_NAME:1}" >> "$GITHUB_ENV"
PANDAS_VERSION=""
fi
echo "PANDAS_VERSION=$PANDAS_VERSION" >> "$GITHUB_ENV"

if [[ "${{ github.event_name }}" == "push" && -n "$PANDAS_VERSION" ]]; then
PUBLISH_PROD="true"
elif [[ "${{ github.event.inputs.publish_prod }}" == "true" ]]; then
PUBLISH_PROD="true"
else
PUBLISH_PROD="false"
fi
echo "PUBLISH_PROD=$PUBLISH_PROD" >> "$GITHUB_ENV"

if [[ "$PUBLISH_PROD" == "true" ]] &&
[[ ! "$PANDAS_VERSION" =~ $version_pat ]]
then
echo "Invalid version $PANDAS_VERSION for publishing to prod."
exit 1
fi

- name: Checkout
Expand Down Expand Up @@ -105,7 +128,7 @@ jobs:

- name: Upload prod docs
run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/version/${{ env.PANDAS_VERSION }}
if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (inputs.publish_prod == 'true') }}
if: ${{ env.PUBLISH_PROD == 'true' }}

- name: Move docs into site directory
run: mv doc/build/html web/build/docs
Expand Down
Loading