-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
5,290 additions
and
525 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,59 @@ | ||
name: Publish Python distributions to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: 'The git ref to build and publish' | ||
required: true | ||
default: 'main' | ||
type: string | ||
release: | ||
types: [published] | ||
|
||
env: | ||
PACKAGE_NAME: exchange_calendars_extensions | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build and publish Python distributions to TestPyPI | ||
name: Build and publish Python distributions to TestPyPI and PyPI. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- name: Install poetry | ||
- name: Install poetry. | ||
run: pipx install poetry | ||
- name: Set up Python 3.10 | ||
- name: Set up Python 3.10. | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: 'poetry' | ||
- name: Generate requirements.txt | ||
- name: Set poetry package version from tag. | ||
run: poetry version ${{ github.ref_name }} | ||
- name: Generate requirements.txt. | ||
run: poetry export -f requirements.txt --without-hashes > requirements.txt | ||
- name: Build package | ||
- name: Build package with poetry. | ||
run: poetry build | ||
- name: Publish distribution 📦 to Test PyPI | ||
- name: Publish package to Test PyPI. | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_PASSWORD }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
- name: Install from testpypi and import | ||
- name: Install from testpypi and import. | ||
run: | | ||
i=0 | ||
while (($i<12)) && [ "0.1.1" != $(pip index versions -i https://test.pypi.org/simple --pre exchange_calendars_extensions | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\ | ||
while (($i<36)) && [[ ! $(curl -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -r '.releases | keys[]') =~ (^|[[:space:]])${{ github.ref_name }}($|[[:space:]]) ]];\ | ||
do echo waiting for package to appear in test index, sleeping 5s; sleep 5s; let i++; done | ||
pip install --index-url https://test.pypi.org/simple exchange_calendars_extensions==0.1.1 --no-deps | ||
pip install --index-url https://test.pypi.org/simple ${{ env.PACKAGE_NAME }}==${{ github.ref_name }} --no-deps | ||
pip install -r requirements.txt | ||
python -c 'import exchange_calendars_extensions;print(exchange_calendars_extensions.__version__)' | ||
python -c 'import ${{ env.PACKAGE_NAME }};print(${{ env.PACKAGE_NAME }}.__version__)' | ||
- name: Clean pip | ||
run: | | ||
pip uninstall -y exchange_calendars_extensions | ||
pip uninstall -y ${{ env.PACKAGE_NAME }} | ||
pip cache purge | ||
- name: Publish distribution 📦 to PyPI | ||
- name: Publish package to PyPI. | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
- name: Install and import | ||
- name: Install and import. | ||
run: | | ||
i=0 | ||
while (($i<12)) && [ "0.1.1" != $(pip index versions -i https://pypi.org/simple --pre exchange_calendars_extensions | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\ | ||
while (($i<36)) && [[ ! $(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -r '.releases | keys[]') =~ (^|[[:space:]])${{ github.ref_name }}($|[[:space:]]) ]];\ | ||
do echo waiting for package to appear in index, sleeping 5s; sleep 5s; let i++; done | ||
pip install --index-url https://pypi.org/simple exchange_calendars_extensions==0.1.1 | ||
python -c 'import exchange_calendars_extensions;print(exchange_calendars_extensions.__version__)' | ||
pip install --index-url https://pypi.org/simple ${{ env.PACKAGE_NAME }}==${{ github.ref_name }} | ||
python -c 'import ${{ env.PACKAGE_NAME }};print(${{ env.PACKAGE_NAME }}.__version__)' |
Oops, something went wrong.