-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (80 loc) · 2.88 KB
/
Copy pathcd.yml
File metadata and controls
94 lines (80 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: CD
on: [push, pull_request, workflow_dispatch]
jobs:
pypi:
name: build and deploy to PyPI
if: github.repository == 'ACCESS-NRI/ACCESS-MOPPeR' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: "ubuntu-latest"
permissions:
id-token: write
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install build dependencies
run: python -m pip install build twine
- name: Build distributions
shell: bash -l {0}
run: |
git clean -xdf
pyproject-build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
conda:
name: build and deploy to conda (${{ matrix.os }})
needs: pypi
if: always() && needs.pypi.result == 'success'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: [3.11]
steps:
- name: Debug matrix info
run: |
echo "Running on: ${{ matrix.os }}"
echo "Python version: ${{ matrix.python-version }}"
echo "Runner OS: ${{ runner.os }}"
- name: Checkout source
uses: actions/checkout@v4
- name: Wait for PyPI propagation
run: |
echo "Waiting for PyPI package to be available..."
PACKAGE_NAME="access-mopper"
VERSION=$(python -c "import versioneer; print(versioneer.get_version())")
echo "Looking for package: ${PACKAGE_NAME}==${VERSION}"
# Wait up to 10 minutes for the package to be available
for i in {1..60}; do
echo "Attempt $i/60: Checking PyPI availability..."
if pip index versions ${PACKAGE_NAME} 2>/dev/null | grep -q "${VERSION}"; then
echo "✅ Package ${PACKAGE_NAME}==${VERSION} is available on PyPI!"
break
fi
if [ $i -eq 60 ]; then
echo "❌ Package not found on PyPI after 10 minutes"
exit 1
fi
echo "Package not yet available, waiting 10 seconds..."
sleep 10
done
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: .conda/environment.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Build and upload the conda package
uses: ACCESS-NRI/action-build-and-upload-conda-packages@v2.0.1
with:
meta_yaml_dir: .conda
python-version: ${{ matrix.python-version }}
user: accessnri
label: main
token: ${{ secrets.anaconda_token }}