Merge pull request #2113 from leggedrobotics/feat/improve-action-log-… #18
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 CLI Tool | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| paths: | |
| - 'cli/**' | |
| - '.github/workflows/updatePypi.yml' | |
| jobs: | |
| update-pypi: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| actions: write | |
| id-token: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Run release script in dev mode to set __local__ False | |
| if: github.ref == 'refs/heads/dev' | |
| run: | | |
| python .github/scripts/release.py --dev | |
| - name: Run release script to set __local__ False | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| python .github/scripts/release.py | |
| - name: Build package | |
| run: | | |
| cd cli | |
| python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@v1.13.0 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| package: cli/dist/* | |
| packages_dir: cli/dist | |
| - name: Get version from setup.cfg | |
| id: get_version | |
| run: | | |
| VERSION=$(grep "version =" cli/setup.cfg | cut -d = -f 2 | xargs) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Trigger Build Sample Actions | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh workflow run build-sample-actions.yml -f kleinkram_version=$VERSION --ref ${{ github.ref }} |