Build and Publish (Depreciated) #70
Workflow file for this run
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: Build and Publish | |
on: | |
push: | |
tags: | |
- 'v*' | |
# branches: | |
# - main | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Build wheel for ${{ matrix.python }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
env: | |
IS_PUSH: ${{ github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v') }} | |
IS_WORKFLOW_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Tag | |
run: | | |
TAG=${{ github.ref_name }} | |
echo "PACKAGE_VERSION=${TAG#v}" >> $GITHUB_ENV | |
shell: bash -el {0} | |
- name: Test tag | |
run: echo $PACKAGE_VERSION | |
shell: bash -el {0} | |
# - name: Set up Python | |
# uses: mamba-org/setup-micromamba@v1 | |
# with: | |
# environment-name: wheel-env | |
# create-args: >- | |
# python=${{ matrix.python }} | |
# anaconda-client | |
# wheel | |
# setuptools | |
# setuptools-git-versioning | |
# build | |
# conda-build | |
# twine | |
# condarc: | | |
# channels: | |
# - defaults | |
# - simpleitk | |
# - conda-forge | |
# cache-downloads: true | |
# cache-environment: true | |
# init-shell: >- | |
# bash | |
# powershell | |
- name: Set Python Version | |
run: echo "PYTHON_VERSION=${{ matrix.python }}" >> $GITHUB_ENV | |
shell: bash -el {0} | |
- name: Set up Python | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniconda-version: "latest" | |
python-version: ${{ matrix.python }} | |
activate-environment: wheel-env | |
environment-file: ./.github/etc/miniconda-environment.yml | |
- name: Build sdist | |
run: | | |
python -m build --sdist --wheel --outdir ./dist/py-${{ matrix.python }} | |
shell: bash -el {0} | |
- name: Build Conda Package | |
if: ${{ success() && (env.IS_PUSH == 'true' || env.IS_WORKFLOW_DISPATCH == 'true') }} | |
run: conda build -c conda-forge -c SimpleITK --output-folder ./conda-bld/py-${{ matrix.python }} ./conda | |
shell: bash -el {0} | |
# - name: Upload conda package | |
# if: ${{ success() && (env.IS_PUSH == 'true' || env.IS_WORKFLOW_DISPATCH == 'true') }} | |
# run: | | |
# anaconda -t ${{ secrets.ANACONDA_TOKEN_MEDIPT }} upload --force ./conda-bld/py-${{ matrix.python }}/*/*.tar.bz2 | |
# anaconda -t ${{ secrets.ANACONDA_TOKEN_MEDIPT }} upload --force ./dist/py-${{ matrix.python }}/*.tar.gz | |
# anaconda -t ${{ secrets.ANACONDA_TOKEN_MEDIPT }} upload --force ./dist/py-${{ matrix.python }}/*.whl | |
# shell: bash -el {0} | |
# - name: Publish to PyPI | |
# if: startsWith(github.ref, 'refs/tags/v') || contains(github.ref, 'refs/tags/v*') | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# password: ${{ secrets.PYPI_API_TOKEN }} | |
# packages-dir: ./dist/py-${{ matrix.python }} |