ci: renames on workflows for simplicity (#4) #1
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 | |
on: | |
push: | |
branches: | |
- main | |
# requires explicit permissions to be granted in the workflow settings | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
publish: | |
name: publish | |
runs-on: ubuntu-latest | |
# only run when a new release is created | |
if: ${{ needs.release.outputs.release_created }} | |
strategy: | |
fail-fast: true | |
matrix: | |
environment: [testpypi, pypi] | |
environment: ${{ matrix.environment }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
- name: Build | |
run: poetry build | |
- name: Publish testpypi | |
if: ${{ matrix.environment=='testpypi' }} | |
env: | |
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/ | |
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__ | |
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{secrets.TESTPYPI_API_TOKEN}} | |
run: poetry publish --repository testpypi | |
- name: Publish pypi | |
if: ${{ matrix.environment=='pypi' }} | |
env: | |
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ | |
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{secrets.PYPI_API_TOKEN}} | |
run: poetry publish |