Upload nightly wheels to Anaconda Cloud #219
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: Upload nightly wheels to Anaconda Cloud | |
on: | |
# Run daily at 2:34 UTC to upload nightly wheels to Anaconda Cloud | |
schedule: | |
- cron: '34 2 * * *' | |
# Run on demand with workflow dispatch | |
workflow_dispatch: | |
permissions: | |
actions: read | |
jobs: | |
upload_nightly_wheels: | |
name: Upload nightly wheels to Anaconda Cloud | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
# The login shell is necessary for the setup-micromamba setup | |
# to work in subsequent jobs. | |
# https://github.com/mamba-org/setup-micromamba#about-login-shells | |
shell: bash -e -l {0} | |
if: github.repository_owner == 'scikit-hep' | |
steps: | |
# https://github.com/actions/download-artifact/issues/3#issuecomment-1017141067 | |
- name: Download wheel artifacts from last build on 'main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PROJECT_REPO="scikit-hep/awkward" | |
BRANCH="main" | |
WORKFLOW_NAME="build-wheels.yml" | |
ARTIFACT_PATTERN="awkward*wheel*" # awkward-wheel and awkward-cpp-wheels-* | |
gh run --repo "${PROJECT_REPO}" \ | |
list --branch "${BRANCH}" \ | |
--workflow "${WORKFLOW_NAME}" \ | |
--json event,status,conclusion,databaseId > runs.json | |
RUN_ID=$( | |
jq --compact-output \ | |
'[ | |
.[] | | |
# Filter on "schedule" and "workflow_dispatch" events to main (nightly build) ... | |
select(.event == "schedule" or .event == "workflow_dispatch") | | |
# that have completed successfully ... | |
select(.status == "completed" and .conclusion == "success") | |
] | | |
# and get ID of latest build of wheels. | |
sort_by(.databaseId) | reverse | .[0].databaseId' runs.json | |
) | |
gh run --repo "${PROJECT_REPO}" view "${RUN_ID}" | |
gh run --repo "${PROJECT_REPO}" \ | |
download "${RUN_ID}" --pattern "${ARTIFACT_PATTERN}" | |
mkdir dist | |
mv ${ARTIFACT_PATTERN}/*.whl dist/ | |
ls -l dist/ | |
- name: Upload wheels to Anaconda Cloud as nightlies | |
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1 | |
with: | |
artifacts_path: dist | |
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} |