Skip to content

Commit

Permalink
Fix publish workflow (#6)
Browse files Browse the repository at this point in the history
* Try enabling postgres

* Explicitly install libpq-dev

* Remove libpq-dev since it's already installed

* Switch psycopg2 to psycopg2-binary

* Revert poetry.lock

* Try installing python-dev

* Fix apt-get install command

* Add alternative publish workflow

* Add dynamic versioning

* Set up alternative publishing workflow for repositories

* Fix faulty publish workflow

* Enable using trusted publisher

* Make alternative publish workflow proper

* Add missing permission setting
  • Loading branch information
phackstock committed Aug 11, 2023
1 parent 7470dce commit 4543b8e
Show file tree
Hide file tree
Showing 3 changed files with 532 additions and 630 deletions.
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/poetry-publish@v1.16
#----------------------------------------------
# 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

0 comments on commit 4543b8e

Please sign in to comment.