debugging #8
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: Publish to PyPI | |
on: #trigger event | |
push: | |
branches: | |
- dev/update_to_1.4.2_automate_publishing | |
permissions: | |
contents: write #grant access to write to master branch | |
jobs: | |
build: | |
name: Build distribution | |
#if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
- name: Get latest tag | |
id: get_tag | |
run: | | |
echo "latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT | |
echo "${{ steps.get_tag.outputs.latest_tag }}" | |
- name: Extract version from tag | |
id: extract_version | |
run: | | |
tag=${{ steps.get_tag.outputs.tag }} | |
echo $tag | |
version=$(echo $tag | cut -d'v' -f2) # Assuming the tag follows a "vX.X.X" format | |
echo "::set-output name=version::$version" | |
- name: Update version in pyproject.toml | |
run: sed -i "s/version = .*/version = \"${{ steps.extract_version.outputs.VERSION }}\"/" pyproject.toml | |
- name: Install pypa/build | |
run: | | |
pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish-to-testpypi: | |
name: Publish | |
#if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
#if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/neuromancer-test | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution 📦 to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} |