Custom testpypi version creation script #12
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 package to test.pypi.org | |
on: | |
push: | |
branches: [main] | |
# TODO: remove the pull_request section | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: write | |
id-token: write | |
concurrency: | |
group: test-pypi-upload | |
jobs: | |
# Upload to Test PyPI on every push to main | |
test-pypi: | |
name: Publish package to test.pypi.org | |
if: github.repository == 'tektronix/tm_devices' | |
runs-on: ubuntu-latest | |
environment: package-testpypi | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: x # any version | |
check-latest: true | |
- name: Install workflow dependencies | |
run: pip install poetry tomli tomli_w requests | |
- name: Create unique package version | |
run: | | |
CURRENT_VERSION=$(python scripts/pypi_latest_version.py --package=tm_devices --index=test.pypi) | |
echo CURRENT_VERSION: $CURRENT_VERSION | |
NEW_VERSION=$(python scripts/create_post_version_for_testpypi.py --version=$CURRENT_VERSION) | |
echo NEW_VERSION: $NEW_VERSION | |
python scripts/project_version.py --set-version=$NEW_VERSION | |
- uses: hynek/[email protected] | |
id: build-pkg | |
- name: Copy package to dist/ folder | |
run: | | |
mkdir -p dist/ | |
cp ${{ steps.build-pkg.outputs.dist }}/*.whl ${{ steps.build-pkg.outputs.dist }}/*.tar.gz dist/ | |
- name: Upload package to Test PyPI | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Test installing from test.pypi.org | |
run: pip install --index-url=https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple | |
tm_devices |