Skip to content

Commit

Permalink
Create publish_to_test_pypi.yml
Browse files Browse the repository at this point in the history
Added an almost direct copy of the publishing to test PyPI workflow from XGA - it won't work yet because there aren't keys available
  • Loading branch information
DavidT3 authored Feb 5, 2024
1 parent b88b7c7 commit b8e8d52
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/publish_to_test_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Large parts of this are directly copied or adapted from
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

# This action triggers the first stage of publishing this module. When a new tag is created and pushed to the remote repository, this action
# will begin. It builds the module, just as it would for an actual PyPI release, then uploads it to the Test PyPI index. That way I can test install
# the package from the test PyPI and not expose the real PyPI index to a potentially buggered version. When I verify that it works, a real publishing can
# be triggered by releasing the module.

# As a reminder to myself, the installation from test PyPI has to be done using this command:
# pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple DAXA

# The overall name of the action
name: Publish DAXA to test PyPI, triggered on creation of tags

# This action triggers when there is a push to the repo
on: push

# Now the actual jobs we want the action to do are setup
jobs:
# The only job in this action, building and publishing the DAXA Python module
build-n-publish:
name: Build and publish DAXA
# I actually only want to run this one if the pushed commit has a tag - I will only do this for new versions of the module
if: startsWith(github.ref, 'refs/tags')
# The build/publishing process runs on Ubuntu 20.04 - not super important what this is for this use case, so long as its not Windows
runs-on: ubuntu-20.04

# This job has several steps
steps:
# Checks out the master branch (what we want to build and publish - hopefully with the VCS info that versioneer needs), then
# activates a relatively recent version of Python
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup the Python install
uses: actions/setup-python@v1
with:
python-version: 3.7

# The next two chunks set up PIP properly and build the module
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
# Then the module is published to the test PyPI index
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/


0 comments on commit b8e8d52

Please sign in to comment.