Skip to content

github: workflow: Add CI for publish the torizon-utils package #2

github: workflow: Add CI for publish the torizon-utils package

github: workflow: Add CI for publish the torizon-utils package #2

name: Publish Torizon Utils
on:
workflow_run:
workflows:
- "Sanity Check"
- "C\/C\\+\\+ Containers"

Check failure on line 7 in .github/workflows/publish-torizon-utils.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-torizon-utils.yaml

Invalid workflow file

You have an error in your yaml syntax on line 7
- "C\/C\\+\\+ Debug Containers"
- "Python Debug Containers"
- "Rust Debug Containers"
- "Python Containers"
- "Rust Containers"
types:
- completed
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
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/*