Release 0.7.0 #20
Workflow file for this run
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
name: zs-yaml CI/CD | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test-build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Install zs-yaml in dev mode | |
run: | | |
pip install -e . | |
- name: Generate schema API for team example | |
run: | | |
cd examples/team | |
zserio team.zs -withTypeInfoCode -python zs_gen_api | |
echo "PYTHONPATH=$PYTHONPATH:$PWD/zs_gen_api" >> $GITHUB_ENV | |
- name: Test team example transformation | |
run: | | |
cd examples/team | |
zs-yaml team1.yaml team1_test_out.bin | |
if [ $? -eq 0 ]; then | |
echo "Transformation successful" | |
else | |
echo "Transformation failed" | |
exit 1 | |
fi | |
- name: Set version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/v* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/v} | |
elif [[ $GITHUB_REF == refs/heads/main ]]; then | |
VERSION=$(python setup.py --version) | |
else | |
VERSION=$(python setup.py --version).dev0 | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "Extracted version: ${VERSION}" | |
sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" zs_yaml/_version.py | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Check distribution | |
run: | | |
twine check dist/* | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.KE_PYPI_TOKEN }} | |
run: | | |
twine upload dist/* |