CI: Remove package versions older than 30 days #23
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Run weekly at 1:23 UTC | |
schedule: | |
- cron: '23 1 * * 0' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: "test upload via action" | |
runs-on: ubuntu-latest | |
if: github.repository == 'scientific-python/upload-nightly-action' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install python-build and twine | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build twine | |
python -m pip list | |
- name: Build a wheel and a sdist | |
run: | | |
PYTHONWARNINGS=error,default::DeprecationWarning python -m build --outdir ./dist tests/test_package | |
- name: Verify the distribution | |
run: twine check --strict dist/* | |
- name: List contents of sdist | |
run: python -m tarfile --list dist/test-package-*.tar.gz | |
- name: List contents of wheel | |
run: python -m zipfile --list dist/test_package-*.whl | |
- name: Test upload | |
uses: ./ | |
with: | |
artifacts_path: dist | |
anaconda_nightly_upload_token: ${{ secrets.UPLOAD_TOKEN }} | |
cleanup: | |
runs-on: ubuntu-latest | |
needs: [test] | |
# Set required workflow secrets in the environment for additional security | |
# https://github.com/scientific-python/upload-nightly-action/settings/environments | |
environment: | |
name: remove-old-wheels | |
steps: | |
- name: Install micromamba and anaconda-client | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: remove-wheels | |
create-args: >- | |
python=3.11 | |
anaconda-client | |
- name: Remove test package upload | |
shell: bash -l {0} | |
run: | | |
anaconda --token ${{ secrets.ANACONDA_TOKEN }} remove \ | |
--force \ | |
"scientific-python-nightly-wheels/test-package" |