diff --git a/.github/workflows/pypi-release.yaml b/.github/workflows/pypi-release.yaml index add9261fcaf..9df929d2cfd 100644 --- a/.github/workflows/pypi-release.yaml +++ b/.github/workflows/pypi-release.yaml @@ -6,11 +6,19 @@ on: push: tags: - "v*" + pull_request: + types: [opened, reopened, synchronize, labeled] + workflow_dispatch: jobs: build-artifacts: runs-on: ubuntu-latest - if: github.repository == 'pydata/xarray' + if: ${{ github.repository == 'pydata/xarray' && ( + (contains(github.event.pull_request.labels.*.name, 'Release') && github.event_name == 'pull_request') || + github.event_name == 'release' || + github.event_name == 'workflow_dispatch' || + startsWith(github.ref, 'refs/tags/v') + ) }} steps: - uses: actions/checkout@v4 with: @@ -64,7 +72,6 @@ jobs: ls -ltrh dist - name: Verify the built dist/wheel is valid - if: github.event_name == 'push' run: | python -m pip install --upgrade pip python -m pip install dist/xarray*.whl diff --git a/HOW_TO_RELEASE.md b/HOW_TO_RELEASE.md index d4ca0d9c2af..e775d63871d 100644 --- a/HOW_TO_RELEASE.md +++ b/HOW_TO_RELEASE.md @@ -48,6 +48,8 @@ upstream https://github.com/pydata/xarray (push) release. 5. Open a PR with the release summary and whatsnew changes; in particular the release headline should get feedback from the team on what's important to include. + Apply the `Release` label to the PR to trigger a test build action. + 6. After merging, again ensure your main branch is synced to upstream: ```sh git pull upstream main