77 workflow_dispatch :
88 inputs :
99 version :
10- description : ' Version to update to (e.g. 2.3.0a9)'
10+ description : ' Version to publish (e.g. 2.3.0a9)'
1111 required : false
1212 type : string
1313
1414jobs :
1515 pypi :
16- name : build and deploy to PyPI
16+ name : Build & Deploy to PyPI
1717 runs-on : ubuntu-latest
1818 permissions :
1919 id-token : write
20+
2021 steps :
21- - name : Checkout source
22- uses : actions/checkout@v5.0.0
23- - name : Set up Python 3.11
22+ - name : Checkout
23+ uses : actions/checkout@v5
24+
25+ - name : Set up Python
2426 uses : actions/setup-python@v6
2527 with :
26- python-version : 3.11
27- - name : Install build dependencies
28- run : python -m pip install build twine
28+ python-version : ' 3.11'
29+
30+ - name : Install build tooling
31+ run : python -m pip install --upgrade pip build twine
32+
2933 - name : Build distributions
30- shell : bash -l {0}
3134 run : |
3235 git clean -xdf
3336 python -m build
34- - name : Publish package to PyPI
37+
38+ - name : Publish to PyPI
3539 uses : pypa/gh-action-pypi-publish@release/v1
3640 with :
3741 skip-existing : true
3842
3943 conda :
40- name : build and deploy to conda
44+ name : Build & Deploy to Conda
4145 needs : pypi
4246 runs-on : ubuntu-latest
47+ env :
48+ PACKAGE : access_moppy
49+
4350 steps :
44- - name : Checkout source
45- uses : actions/checkout@v5.0.0
46- - name : Wait for PyPI propagation
51+ - name : Checkout
52+ uses : actions/checkout@v5
53+
54+ - name : Derive Version
55+ id : ver
4756 run : |
48- echo "Waiting for PyPI package to be downloadable..."
49- PACKAGE_NAME="access_moppy"
50- TAG="${GITHUB_REF_NAME}"
51- VERSION="${TAG#moppy-}"
52- VERSION="${VERSION#v}"
53- echo "Looking for package: ${PACKAGE_NAME}==${VERSION}"
54- for i in {1..90}; do
55- echo "Attempt $i/90: Trying to download wheel and sdist..."
56- rm -rf /tmp/pypi_check_download && mkdir -p /tmp/pypi_check_download
57- pip download --no-deps --dest /tmp/pypi_check_download ${PACKAGE_NAME}==${VERSION} >/dev/null 2>&1
58- pip download --no-deps --no-binary=:all: --dest /tmp/pypi_check_download ${PACKAGE_NAME}==${VERSION} >/dev/null 2>&1
59- WHEEL=$(ls /tmp/pypi_check_download/*.whl 2>/dev/null | head -1)
60- SDIST=$(ls /tmp/pypi_check_download/*.tar.gz 2>/dev/null | head -1)
61- if [[ -n "$WHEEL" && -n "$SDIST" ]]; then
62- echo "✅ Both wheel and sdist for ${PACKAGE_NAME}==${VERSION} are downloadable!"
63- break
64- fi
65- if [ $i -eq 90 ]; then
66- echo "❌ Could not download both wheel and sdist after 15 minutes"
67- echo "Available files:"
68- ls -l /tmp/pypi_check_download || echo "No files downloaded"
69- exit 1
57+ tag="${GITHUB_REF_NAME}"
58+ ver="${tag#moppy-}"
59+ ver="${ver#v}"
60+ echo "version=$ver" >> $GITHUB_OUTPUT
61+
62+ - name : Wait for PyPI availability (fast check)
63+ env :
64+ VER : ${{ steps.ver.outputs.version }}
65+ run : |
66+ echo "Checking PyPI for $PACKAGE==$VER..."
67+ for i in {1..60}; do
68+ if curl -sf https://pypi.org/pypi/$PACKAGE/$VER/json > /dev/null; then
69+ echo "🟢 Found $PACKAGE==$VER on PyPI"
70+ exit 0
7071 fi
71- echo "Files not yet downloadable, waiting 10 seconds ..."
72+ echo "Waiting ... $i/60 "
7273 sleep 10
7374 done
74- - name : Setup conda environment
75+ echo "❌ Timeout waiting for $PACKAGE==$VER on PyPI"
76+ exit 1
77+
78+ - name : Setup conda
7579 uses : conda-incubator/setup-miniconda@v3
7680 with :
7781 auto-activate-base : true
7882 channels : conda-forge
79- - name : Install conda build tools
80- run : |
81- conda install -y conda-build anaconda-client
82- - name : Build and upload the conda package
83- uses : ACCESS-NRI/action-build-and-upload-conda-packages@d97711bc4445ba5c4de55f5a1bccbd4815286289
83+
84+ - name : Cache conda build
85+ uses : actions/cache@v4
86+ with :
87+ path : ~/.conda-build
88+ key : conda-bld-${{ runner.os }}
89+ restore-keys : |
90+ conda-bld-
91+
92+ - name : Install conda build tooling
93+ run : conda install -y conda-build anaconda-client
94+
95+ - name : Build & Upload to Conda
96+ uses : ACCESS-NRI/action-build-and-upload-conda-packages@main
8497 with :
8598 meta_yaml_dir : .conda
8699 upload : true
87100 user : accessnri
88101 label : main
89- token : ${{ secrets.anaconda_token }}
102+ token : ${{ secrets.ANACONDA_TOKEN }}
90103
91104 update_analysis3 :
92- name : Update ACCESS-MOPPy on Analysis3 Conda Environment
105+ name : Update access-moppy in Analysis3
93106 needs : conda
94107 runs-on : ubuntu-latest
95108 permissions :
@@ -101,9 +114,9 @@ jobs:
101114 FILE_PATH : environments/analysis3/environment.yml
102115 PACKAGE : access-moppy
103116 CHANNEL : accessnri
104- RELEASE_TAG : ${{ github.ref_name }}
105- INPUT_VERSION : ${{ github.event.inputs.version }}
106117 GH_TOKEN : ${{ secrets.GH_ANALYSIS3_DEPLOY }}
118+ INPUT_VERSION : ${{ github.event.inputs.version }}
119+ RELEASE_TAG : ${{ github.ref_name }}
107120 steps :
108121 - name : Derive version string
109122 id : ver
0 commit comments