Merge pull request #449 from AllenCell/workflow-release #20
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
# Publishes to PyPI when a commit tagged with v** is pushed to main | |
name: Publish to Artifactory | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- version.toml | |
# need to grab org secrets for artifactory publish | |
env: | |
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} | |
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
# run artifactory releases on self-hosted runner, change when using pypi | |
jobs: | |
publish: | |
name: Publish | |
runs-on: [self-hosted, build] | |
environment: release | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
# We need twine as a dependency below for artifactory releases, remove when using pypi | |
# importlib 8.0.0 is broken, we should be able to un-pin this once 8.0.1 is released | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
pip install importlib_metadata==7.2.1 | |
- name: Build Package | |
run: | | |
python -m build | |
# disabling publish to pypi, replacing with artifactory for now | |
# replace this when we want to publish to pypi instead | |
# - name: Publish to PyPI | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to Artifactory | |
env: | |
TWINE_USERNAME: ${{ secrets.ARTIFACTORY_USER }} | |
TWINE_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
TWINE_NON_INTERACTIVE: true | |
run: twine upload --verbose --repository-url='https://artifactory.corp.alleninstitute.org/artifactory/api/pypi/pypi-release-local' dist/* | |