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

ENH: Add optional anaconda_nightly_upload_organization argument #47

Merged
merged 6 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ then generate a token at `https://anaconda.org/scientific-python-nightly-wheels/
with permissions to _Allow write access to the API site_ and _Allow uploads to Standard Python repositories_,
and add the token as a secret to your GitHub repository.

## Using a different channel

This Github Action can upload your nightly builds to a different channel. To do so,
you will required to define `anaconda_nightly_upload_url` variable. See below:

```yml
jobs:
steps:
...
- name: Upload wheel
uses: scientific-python/upload-nightly-action@5fb764c5bce1ac2297084c0f7161b1919f17c74f # 0.2.0
with:
artifacts_path: dist
anaconda_nightly_upload_url: my-alternative-scientific-channel
anaconda_nightly_upload_token: ${{secrets.UPLOAD_TOKEN}}
```

## Artifact cleanup-policy at the ``scientific-python-nightly-wheels`` channel

To avoid hosting outdated development versions, as well as to clean up space, we do have a
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ inputs:
anaconda_nightly_upload_token:
description: 'Token to upload to scientific python org'
required: true
anaconda_nightly_upload_url:
description: 'URL to upload to scientific python org'
skoudoro marked this conversation as resolved.
Show resolved Hide resolved
required: false
default: scientific-python-nightly-wheels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default: scientific-python-nightly-wheels
default: scientific-python-nightly-wheels

I don't know how the action works, but this is confusing since it isn't a URL.
If it can be anything other than a URL, that should either be documented or the field be renamed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the variable name is wrong! it should be anaconda_nightly_upload_organization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing the default will break downstream packages using this action as soon as it is merged like scikit-image

scikit-image is using main. Maybe we can update this in a new PR and let some time to all downstream package to add/update this variable.

anaconda_nightly_upload_labels:
description: 'Labels assigned to the uploaded artifacts'
matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved
required: false
default: main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the label needed? This is a change in current behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, the label is main when you upload an artifact in anaconda

image

in our case (https://anaconda.org/dipy/dipy), the organization name is not explicit. I would like to avoid random people downloading nightly wheels and believing that is it a release. So, we tag them as dev instead of main (see the difference between the sreenshot above and below

image

one artifact can have one or multiple labels. I am fine for alternative solution to avoid confusion with users (since I can relabel all the old artifacts)

Documentation on anaconda label: https://docs.anaconda.com/free/anacondaorg/user-guide/work-with-labels/

skoudoro marked this conversation as resolved.
Show resolved Hide resolved

runs:
using: 'docker'
Expand Down
4 changes: 3 additions & 1 deletion cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ set -x
# this is to prevent accidental uploads
echo "Getting anaconda token from github secrets..."

ANACONDA_ORG="scientific-python-nightly-wheels"
ANACONDA_ORG="${INPUT_ANACONDA_NIGHTLY_UPLOAD_URL}"
ANACONDA_TOKEN="${INPUT_ANACONDA_NIGHTLY_UPLOAD_TOKEN}"
ANACONDA_LABELS="${INPUT_ANACONDA_NIGHTLY_UPLOAD_LABELS}"

# if the ANACONDA_TOKEN is empty, exit with status -1
# this is to prevent accidental uploads
Expand Down Expand Up @@ -48,5 +49,6 @@ echo "Uploading wheels to anaconda.org..."
anaconda --token "${ANACONDA_TOKEN}" upload \
--force \
--user "${ANACONDA_ORG}" \
--label "${ANACONDA_LABELS}" \
"${INPUT_ARTIFACTS_PATH}"/*.whl
echo "Index: https://pypi.anaconda.org/${ANACONDA_ORG}/simple"