Skip to content

Commit

Permalink
Add publish GitHub Action workflow (#87)
Browse files Browse the repository at this point in the history
* Add publish GitHub Action workflow

Signed-off-by: Fabrice Normandin <[email protected]>

* Don't install dev dependencies when publishing

Signed-off-by: Fabrice Normandin <[email protected]>

* Add auto-versioning with a poetry plugin

Signed-off-by: Fabrice Normandin <[email protected]>

* Remove poetry version from matrix

Signed-off-by: Fabrice Normandin <[email protected]>

* Modify workflow so it uses PyPI token

Signed-off-by: Fabrice Normandin <[email protected]>

* Rename env variable based on poetry docs

Signed-off-by: Fabrice Normandin <[email protected]>

---------

Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice authored Jan 18, 2024
1 parent 8ad21e5 commit 1cad727
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Poetry when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
release:
types: [published]

jobs:
publish:
strategy:
matrix:
python-version: [3.9]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
environment: release
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry

- name: Install dependencies
run: poetry install

- name: Publish package
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --build
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "milatools"
version = "0.0.18"
version = "0.0.0"
description = "Tools to work with the Mila cluster"
authors = ["Olivier Breuleux <[email protected]>"]
readme = "README.md"
Expand Down Expand Up @@ -48,6 +48,10 @@ combine_as_imports = true
addopts = "--doctest-modules"
markers = "--enable-internet: Allow some tests to run using real connections to the cluster."


[tool.poetry-dynamic-versioning]
enable = true

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

0 comments on commit 1cad727

Please sign in to comment.