Skip to content

Migrate to hatch

Migrate to hatch #1735

Workflow file for this run

name: Package
on: [push, pull_request]
jobs:
build-distribution:
runs-on: "ubuntu-latest"
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install pypa/build and chartpress
run: python -m pip install hatch build wheel chartpress pyyaml
# chartpress pushes a packages Helm chart to dask/helm-chart's gh-pages
# branch, so we need to have a git user.email and user.name configured
- name: Configure a git user
run: |
git config --global user.email "github-actions@example.local"
git config --global user.name "GitHub Actions user"
- name: Build distributions
shell: bash -l {0}
run: hatch build
- name: Publish package to PyPI
if: github.repository == 'dask/dask-kubernetes' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Get the version
id: get_version
run: |
if [[ "$GITHUB_REF" == *"refs/tags"* ]]; then
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
else
echo ::set-output name=VERSION::dev
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.repository == 'dask/dask-kubernetes' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish operator Helm chart with chartpress
env:
# chartpress can make use of a personal access token by setting these
# environment variables like this, for details see:
# https://github.com/jupyterhub/chartpress/blob/d4e2346d50f0724f6bee387f4f8aebc108afb648/chartpress.py#L118-L128
#
GITHUB_ACTOR: ""
GITHUB_TOKEN: "${{ secrets.dask_bot_token }}"
PUBLISH: ${{ github.repository == 'dask/dask-kubernetes' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
run: |
cd dask_kubernetes/operator/deployment/helm
if ${PUBLISH} == true; then
chartpress --force-push --force-publish-chart
else
chartpress
fi