|
13 | 13 | steps: |
14 | 14 | - uses: actions/checkout@v2 |
15 | 15 | with: |
16 | | - fetch-depth: 0 |
| 16 | + fetch-depth: 0 # This is important for setuptools_scm to get the git history |
17 | 17 | - name: Set up Python 3.8 |
18 | 18 | uses: actions/setup-python@v2 |
19 | 19 | with: |
|
22 | 22 | run: | |
23 | 23 | # $CONDA is an environment variable pointing to the root of the miniconda directory |
24 | 24 | echo $CONDA/bin >> $GITHUB_PATH |
| 25 | + - name: Extract tag version for conda build |
| 26 | + id: get_version |
| 27 | + run: | |
| 28 | + # Extract the tag name without 'refs/tags/' prefix |
| 29 | + GIT_TAG=${GITHUB_REF#refs/tags/} |
| 30 | + # Set tag as environment variable for conda build |
| 31 | + echo "GIT_DESCRIBE_TAG=$GIT_TAG" >> $GITHUB_ENV |
| 32 | + # Also set SETUPTOOLS_SCM_PRETEND_VERSION for consistent versioning |
| 33 | + echo "SETUPTOOLS_SCM_PRETEND_VERSION=$GIT_TAG" >> $GITHUB_ENV |
| 34 | + # Print for verification |
| 35 | + echo "Using version: $GIT_TAG" |
25 | 36 | - name: Conda build package and upload to anaconda.org |
26 | 37 | env: |
27 | 38 | ANACONDA_CHANNEL_UPLOAD_TOKEN: ${{ secrets.ANACONDA_CHANNEL_UPLOAD_TOKEN }} |
|
30 | 41 | source $CONDA/etc/profile.d/conda.sh |
31 | 42 | conda activate test_dmsbatch |
32 | 43 | conda config --set anaconda_upload yes |
| 44 | + echo "Building with GIT_DESCRIBE_TAG=$GIT_DESCRIBE_TAG and SETUPTOOLS_SCM_PRETEND_VERSION=$SETUPTOOLS_SCM_PRETEND_VERSION" |
33 | 45 | conda build -c defaults -c conda-forge --user cadwr-dms --token "$ANACONDA_CHANNEL_UPLOAD_TOKEN" conda.recipe |
34 | 46 | conda activate |
35 | 47 | conda remove -n test_dmsbatch --all |
| 48 | + |
| 49 | + - name: Build and upload PyPI package |
| 50 | + if: ${{ false }} # Disabled by default - enable when ready to publish to PyPI |
| 51 | + env: |
| 52 | + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 53 | + run: | |
| 54 | + python -m pip install --upgrade pip build twine |
| 55 | + python -m build |
| 56 | + python -m twine upload --skip-existing dist/* --username __token__ --password "$PYPI_API_TOKEN" |
0 commit comments