-
Notifications
You must be signed in to change notification settings - Fork 13
Add a separate action for removing old wheels #95
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
base: main
Are you sure you want to change the base?
Changes from 30 commits
d6264b8
9d4f667
002d2e5
40cd6bc
8a33f20
b18b4a1
deb3cba
05770f3
199b1c8
f8b96a0
70f8a3d
2fac172
6a1b65e
8bb7bb6
bae5ad6
f916adc
afedc16
35c9d59
7a7dbbc
7830eae
2f62d85
1f04be6
b6dbd44
88ce687
03979b0
bf8e993
433e7c3
4a3497d
71ede79
2d2e62a
556e9a6
e403c81
15b617e
288b2f2
9a447eb
6b0a6a1
3d1fb55
e8796a6
b58e1ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,11 +18,43 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| anaconda_nightly_upload_token: ${{secrets.UPLOAD_TOKEN}} | ||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Note that we recommend pinning the action against a specific SHA | ||||||||||||||||||||||||||||||||||||||||||
| > [!IMPORTANT] | ||||||||||||||||||||||||||||||||||||||||||
| > Note that we recommend pinning the action against a specific SHA | ||||||||||||||||||||||||||||||||||||||||||
| (rather than a tag), to guard against the unlikely event of upstream | ||||||||||||||||||||||||||||||||||||||||||
| being compromised. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## Updating the action | ||||||||||||||||||||||||||||||||||||||||||
| # Removing old nightly builds | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| This repository also ships with an action to ease removals of older nightly wheels from a channel. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| To use this functionality, add the following snippet to your workflow: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ```yml | ||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||
| ... | ||||||||||||||||||||||||||||||||||||||||||
| - name: Remove old wheels | ||||||||||||||||||||||||||||||||||||||||||
| uses: scientific-python/upload-nightly-action/remove-wheels@cantknowhashyet # 0.6.0 | ||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||
| n_latest_uploads: ${{ env.N_LATEST_UPLOADS }} | ||||||||||||||||||||||||||||||||||||||||||
| anaconda_nightly_upload_organization: "your-organization" | ||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is called organization, not channel; are these interchangeable terms? If so, use channel; if not, explain the difference.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not quite sure, since they look like they have been used interchangeably. For example, the README outside of this PR: upload-nightly-action/README.md Lines 48 to 67 in 920fb59
mentions how one may upload to a different channel, but it uses "organization" as an input. |
||||||||||||||||||||||||||||||||||||||||||
| anaconda_nightly_token: ${{secrets.ANACONDA_TOKEN}} | ||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Which will remove all but the `n_latest_uploads` latest uploads from the channel. This is useful | ||||||||||||||||||||||||||||||||||||||||||
| to avoid hosting outdated development versions, as well as to clean up space. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Note that the ``scientific-python-nightly-wheels`` channel, specifically, already removes | ||||||||||||||||||||||||||||||||||||||||||
|
agriyakhetarpal marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||||||||||||
| old artifacts daily. The `remove-wheels` action is, therefore, intended for use with | ||||||||||||||||||||||||||||||||||||||||||
| other channels. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| If you do not wish to have this automated cleanup, please [open an issue](https://github.com/scientific-python/upload-nightly-action/) | ||||||||||||||||||||||||||||||||||||||||||
| to be added to the list of packages exempt from it. The current ones are named in | ||||||||||||||||||||||||||||||||||||||||||
| [`packages-ignore-from-cleanup.txt`](packages-ignore-from-cleanup.txt). | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Please refer to the [artifact cleanup policy][] for more information. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## Updating the actions | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| You can [use Dependabot to keep the GitHub Action up to date][], | ||||||||||||||||||||||||||||||||||||||||||
| with a `.github/dependabot.yml` config file similar to: | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -45,7 +77,7 @@ then generate a token at `https://anaconda.org/<anaconda cloud user name>/settin | |||||||||||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||||||||||||
| ## Using a channel other than ``scientific-python-nightly-wheels`` | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| This Github Action can upload your nightly builds to a different channel. To do so, | ||||||||||||||||||||||||||||||||||||||||||
| define the `anaconda_nightly_upload_organization` variable. Furthermore, | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -65,6 +97,15 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| anaconda_nightly_upload_labels: dev | ||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Similarly, to delete old wheels from a different channel, you can use the `anaconda_nightly_organization` | ||||||||||||||||||||||||||||||||||||||||||
| parameter as described above. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Please note that the `anaconda_nightly_token` secret must have the necessary permissions to | ||||||||||||||||||||||||||||||||||||||||||
| remove artifacts from the channel. A token for a particular package will delete only the | ||||||||||||||||||||||||||||||||||||||||||
| artifacts uploaded by that package. If you need to delete artifacts uploaded by other packages | ||||||||||||||||||||||||||||||||||||||||||
| similar to the `scientific-python-nightly-wheels` channel here, you will need to use a token | ||||||||||||||||||||||||||||||||||||||||||
| for the organization with higher permissions that lets you delete packages organization-wide. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## 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 | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -112,3 +153,4 @@ dependencies: | |||||||||||||||||||||||||||||||||||||||||
| [PyPI]: https://pypi.org/ | ||||||||||||||||||||||||||||||||||||||||||
| [scientific-python nightly channel]: https://anaconda.org/scientific-python-nightly-wheels | ||||||||||||||||||||||||||||||||||||||||||
| [SPEC4 — Using and Creating Nightly Wheels]: https://scientific-python.org/specs/spec-0004/ | ||||||||||||||||||||||||||||||||||||||||||
| [artifact cleanup policy]: #artifact-cleanup-policy-at-the-scientific-python-nightly-wheels-channel | ||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Scientific Python / Remove Old Wheels | ||
| description: A GitHub Action to remove old wheels | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| metadata: read | ||
| author: "Scientific-Python" | ||
| # TODO: have to think about versioning; whether to version separately, or | ||
| # for it to be in sync with the version for the upload action | ||
| version: "0.1.0" # should be kept in sync with the version in remove-wheels/pixi.toml | ||
|
|
||
| inputs: | ||
| n_latest_uploads: | ||
| description: 'The number of previous wheel uploads to keep' | ||
| required: false | ||
| default: '5' | ||
| anaconda_nightly_upload_organization: | ||
| description: 'Anaconda Cloud organisation name to remove the wheels from' | ||
| required: false | ||
| default: scientific-python-nightly-wheels | ||
| anaconda_nightly_token: | ||
| description: 'Anaconda Cloud API token to authenticate with' | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Set up pixi | ||
| uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1 | ||
| with: | ||
| locked: true | ||
| cache: true | ||
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | ||
| # Avoid post cleanup errors if action run multiple times | ||
| post-cleanup: false | ||
| # Action consumers should load the lock file from the action repo | ||
| manifest-path: ${{ github.action_path }}/pixi.toml | ||
|
|
||
| - name: Remove old wheels | ||
| shell: bash | ||
| env: | ||
| INPUT_N_LATEST_UPLOADS: ${{ inputs.n_latest_uploads }} | ||
| INPUT_ANACONDA_USER: ${{ inputs.anaconda_user }} | ||
| INPUT_ANACONDA_TOKEN: ${{ inputs.anaconda_token }} | ||
| run: | | ||
| pixi run --manifest-path ${{ github.action_path }}/remove-wheels/pixi.toml ${{ github.action_path }}/remove_wheels.sh |
Uh oh!
There was an error while loading. Please reload this page.