Skip to content

Commit

Permalink
github: workflow: Add CI for publish the torizon-utils package
Browse files Browse the repository at this point in the history
The templates uses xonsh with Python 🤢 now 😢.
We need some utils to help us to create the templates and
the CI/CD pipeline, so I created a package called torizon-templates-utils.
This package will be published on PyPI every time that a workflow
finishes successfully and there is a new version.

Signed-off-by: Matheus Castello <[email protected]>
  • Loading branch information
microhobby committed Jan 15, 2025
1 parent c24daa6 commit c8da507
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/publish-torizon-utils.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Torizon Utils

on:
workflow_run:
workflows:
- "Sanity Check"
- "C\/C\\+\\+ Containers"
- "C\/C\\+\\+ Debug Containers"
- "Python Debug Containers"
- "Rust Debug Containers"
- "Python Containers"
- "Rust Containers"
types:
- completed

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Sanity version
run: |
# read the toml
version=$(cat ./scripts/utils/pip/pyproject.toml | grep version | cut -d '"' -f 2)
# check with the latest version published on pypi
latest_version=$(curl -s https://pypi.org/pypi/torizon-templates-utils/json | jq -r '.info.version')
if [ "$version" == "$latest_version" ]; then
echo "Version $version is already published on PyPI"
exit 1
fi
- name: Create Package
run: |
cd ./scripts/utils/pip
python3 -m build
- name: Create .pypirc
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_CREDS }}
run: |
echo "[pypi]" > ./scripts/utils/pip/.pypirc
echo "username = $TWINE_USERNAME" >> ./scripts/utils/pip/.pypirc
echo "password = $TWINE_PASSWORD" >> ./scripts/utils/pip/.pypirc
- name: Publish Package
run: |
cd ./scripts/utils/pip
python3 -m \
twine \
upload \
--config-file .pypirc \
dist/*
2 changes: 1 addition & 1 deletion scripts/utils/pip/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "torizon_templates_utils"
version = "0.0.1"
version = "0.0.4"
authors = [
{ name="Matheus Castello", email="[email protected]" },
]
Expand Down

0 comments on commit c8da507

Please sign in to comment.