Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publish workflow #6

Merged
merged 14 commits into from
Aug 11, 2023
54 changes: 35 additions & 19 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
name: Publish ixmp4
# copied from https://github.com/marketplace/actions/install-poetry-action
name: publish

on:
push:
tags: ["v*"]
release:
types: ["published"]
workflow_dispatch:

jobs:
build:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
# publish to pypi
- if: github.event_name == 'release'
name: Build and publish to pypi
uses: JRubics/[email protected]
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
plugins: "poetry-dynamic-versioning[plugin]"
python_version: "3.10"
# publish to testpypi
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install poetry dynamic versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Build package
run: poetry build
- if: github.event_name == 'release'
name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- if: github.event_name != 'release'
name: Build and publish to testpypi
uses: JRubics/poetry-publish@v1.16
name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
python_version: "3.10"
repository_name: "testpypi"
repository_url: "https://test.pypi.org/legacy/"
pypi_token: ${{ secrets.TESTPYPI_TOKEN }}
plugins: "poetry-dynamic-versioning[plugin]"
repository-url: https://test.pypi.org/legacy/
Loading
Loading