fix: add repository information to package.json #70
This file contains hidden or 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: Build and Deploy Python Parser | |
| on: | |
| push: | |
| branches: [develop, main] | |
| tags: ['v*'] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install ANTLR4 and Python dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3 python3-pip | |
| make dev | |
| - name: Generate and Build Python Code | |
| run: make python_parser | |
| - name: Set dev version (develop branch) | |
| if: github.ref == 'refs/heads/develop' | |
| run: | | |
| cd python | |
| BASE_VERSION=$(grep -oP 'version="\K[0-9]+\.[0-9]+\.[0-9]+' setup.py) | |
| DEV_VERSION="${BASE_VERSION}.dev${GITHUB_RUN_NUMBER}" | |
| sed -i "s/version=\"[^\"]*\"/version=\"${DEV_VERSION}\"/" setup.py | |
| echo "Publishing version: ${DEV_VERSION}" | |
| - name: Set release version (main branch) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| cd python | |
| BASE_VERSION=$(grep -oP 'version="\K[0-9]+\.[0-9]+\.[0-9]+' setup.py) | |
| echo "Publishing version: ${BASE_VERSION}" | |
| - name: Set release version (tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| cd python | |
| TAG_VERSION=${GITHUB_REF_NAME#v} | |
| sed -i "s/version=\"[^\"]*\"/version=\"${TAG_VERSION}\"/" setup.py | |
| echo "Publishing version: ${TAG_VERSION}" | |
| - name: Build and publish python package | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| make python_prepare_package | |
| cd python && twine upload dist/* |