debugging #20
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 And version | |
id: get_tag_and_version | |
run: | | |
git fetch -a | |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "latest_tag=$latest_tag" >> $GITHUB_ENV | |
version=$(echo "$latest_tag" | cut -d'v' -f2) | |
echo "version=$version" >> $GITHUB_ENV | |
echo "The version is $version" | |
- name: Update version in pyproject.toml | |
run: sed -i "s/version = .*/version = \"\${{ env.VERSION }}\"/" pyproject.toml | |
env: | |
VERSION: ${{ env.version }} | |
- 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 }} |