-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: workflow: Add CI for publish the torizon-utils package
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
1 parent
c24daa6
commit c8da507
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]" }, | ||
] | ||
|