|
| 1 | +name: Upload nightly wheels to Anaconda Cloud |
| 2 | + |
| 3 | +on: |
| 4 | + # Run daily at 1:23 UTC to upload nightly wheels to Anaconda Cloud |
| 5 | + schedule: |
| 6 | + - cron: '23 1 * * *' |
| 7 | + # Run on demand with workflow dispatch |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + upload_nightly_wheels: |
| 12 | + name: Upload nightly wheels to Anaconda Cloud |
| 13 | + runs-on: ubuntu-latest |
| 14 | + if: github.repository_owner == 'matplotlib' |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Install Python |
| 18 | + uses: actions/setup-python@v3 |
| 19 | + with: |
| 20 | + python-version: '3.x' |
| 21 | + |
| 22 | + # c.f. https://github.com/actions/download-artifact/issues/3#issuecomment-1017141067 |
| 23 | + - name: Download wheel artifacts from last build on 'main' |
| 24 | + shell: bash |
| 25 | + env: |
| 26 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + run: | |
| 28 | + PROJECT_REPO="matplotlib/matplotlib" |
| 29 | + BRANCH="main" |
| 30 | + WORKFLOW_NAME="cibuildwheel.yml" |
| 31 | + ARTIFACT_NAME="wheels" |
| 32 | +
|
| 33 | + gh run --repo "${PROJECT_REPO}" \ |
| 34 | + list --branch "${BRANCH}" \ |
| 35 | + --workflow "${WORKFLOW_NAME}" \ |
| 36 | + --json event,status,databaseId > runs.json |
| 37 | + # Filter on 'push' events to main (merged PRs) that have completed |
| 38 | + jq --compact-output \ |
| 39 | + '[ .[] | select(.event == "push") | select(.status == "completed") ]' \ |
| 40 | + runs.json > pushes.json |
| 41 | + # Get id of latest build of wheels |
| 42 | + RUN_ID=$( |
| 43 | + jq --compact-output \ |
| 44 | + 'sort_by(.databaseId) | reverse | .[0].databaseId' pushes.json |
| 45 | + ) |
| 46 | + gh run --repo "${PROJECT_REPO}" \ |
| 47 | + download "${RUN_ID}" --name "${ARTIFACT_NAME}" |
| 48 | +
|
| 49 | + mkdir dist |
| 50 | + mv *.whl dist/ |
| 51 | + ls -l dist/ |
| 52 | +
|
| 53 | + - name: Install anaconda-client |
| 54 | + run: | |
| 55 | + python -m pip install --upgrade pip setuptools wheel |
| 56 | + # c.f. https://github.com/Anaconda-Platform/anaconda-client/issues/540 |
| 57 | + python -m pip install git+https://github.com/Anaconda-Server/anaconda-client |
| 58 | + python -m pip list |
| 59 | +
|
| 60 | + - name: Upload wheels to Anaconda Cloud as nightlies |
| 61 | + run: | |
| 62 | + anaconda --token ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} upload \ |
| 63 | + --user scipy-wheels-nightly \ |
| 64 | + dist/matplotlib-*.whl |
0 commit comments