Add check to ensure release drafter doesn't run on forks #1725
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package | |
on: [push, pull_request] | |
jobs: | |
build-distribution: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- 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 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 "[email protected]" | |
git config --global user.name "GitHub Actions user" | |
- name: Build distributions | |
shell: bash -l {0} | |
run: python setup.py sdist bdist_wheel | |
- 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@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
- 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 | |