Merge pull request #55 from StirNetwork/feat/#40 #13
Workflow file for this run
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
| # SPDX-FileCopyrightText: 2025 Ethersecurity Inc. | |
| # | |
| # SPDX-License-Identifier: MPL-2.0 | |
| # Author: Shohei KAMON <cameong@stir.network> | |
| name: Publish to PyPI | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger on any tag push | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish: | |
| name: Build and publish to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade setuptools wheel build twine | |
| - name: Check version format | |
| id: check_version | |
| run: | | |
| if [[ "${GITHUB_REF##*/}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Valid version tag detected: ${GITHUB_REF##*/}" | |
| echo "VERSION_VALID=true" >> $GITHUB_ENV | |
| else | |
| echo "Invalid version tag detected: ${GITHUB_REF##*/}" | |
| echo "VERSION_VALID=false" >> $GITHUB_ENV | |
| fi | |
| - name: Build for PyPI | |
| run: | | |
| python -m build | |
| - name: publish to PyPI | |
| if: env.VERSION_VALID == 'true' | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| twine upload --repository pypi dist/* | |
| - name: Generate SHA256 | |
| run: | | |
| sha256sum dist/*.tar.gz > dist/fireblocks-cli-${GITHUB_REF##*/}.tar.gz.sha256 | |
| - name: Upload Release Assets to GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| files: | | |
| dist/*.tar.gz | |
| dist/*.tar.gz.sha256 | |
| generate_release_notes: true | |
| create_release: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |