Skip to content

Commit

Permalink
ci: add release ci with upload to test.pypi.org and pypi.org
Browse files Browse the repository at this point in the history
small adpatation in the pyproject.toml
  • Loading branch information
ngruelaneo committed Mar 6, 2024
1 parent 5e9444e commit d38d08c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release Packages

permissions:
contents: write

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
# We need to verify the version in some packages with the tag in order to have the same version in all packages (python, csharp, angular, web).
# Some packages use an internal version (like csharp, angular and web) and some use the tag version (like python).

release-python-package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0

- name: pip update and add build package
run: |
pip install build
python -m build
- name: Upload as artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3
with:
name: python-packages
path: dist/

- name: Publish to PyPITest
if: github.ref != 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.DEV_PYPI_API_TOKEN }}
print-hash: true
packages-dir: dist/
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true
packages_dir: dist/
update-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0

- name: Set node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: 18

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
_version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build-system]
requires = ["setuptools",
"setuptools-scm",
"wheel"]
build-backend = "setuptools.build_meta"

Expand All @@ -21,9 +22,8 @@ Homepage = "https://github.com/aneoconsulting/ArmoniK.Analytics"
repository = "https://github.com/aneoconsulting/ArmoniK.Analytics"
"Bug Tracker" = "https://github.com/aneoconsulting/ArmoniK.Analytics/issues"

[tool.setuptools]
include-package-data = true
dynamic = {version = {attr = "armonik_analytics.__version__"}}
[tool.setuptools_scm]
write_to = "src/armonik_analytics/_version.py"

[tool.setuptools.packages.find]
where= ["src"]
Expand Down
1 change: 0 additions & 1 deletion src/armonik_analytics/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = "0.1.0"

0 comments on commit d38d08c

Please sign in to comment.