release #113
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: release | |
| on: [workflow_dispatch] | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| concurrency: release | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/codelimit | |
| permissions: | |
| id-token: write | |
| contents: write | |
| outputs: | |
| version: ${{ steps.release.outputs.version }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: uv sync --locked --dev | |
| - name: Python Semantic Release | |
| id: release | |
| uses: relekang/python-semantic-release@v9.21.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update checkout | |
| if: steps.release.outputs.released == 'true' | |
| run: git pull | |
| - name: Update lock file | |
| if: steps.release.outputs.released == 'true' | |
| run: uv lock | |
| - name: Build distribution | |
| if: steps.release.outputs.released == 'true' | |
| run: uv build | |
| - name: Publish to PyPI | |
| if: steps.release.outputs.released == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Commit changes | |
| if: steps.release.outputs.released == 'true' | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: Build by GitHub Actions | |
| file_pattern: uv.lock | |
| release_binaries: | |
| name: Release binaries | |
| needs: release | |
| defaults: | |
| run: | |
| shell: bash | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| TARGET: macos | |
| CMD_BUILD: | | |
| uv run pyinstaller \ | |
| -n codelimit -F codelimit/__main__.py | |
| mv dist/codelimit dist/codelimit-macos | |
| OUT_FILE_NAME: dist/codelimit-macos | |
| - os: windows-latest | |
| TARGET: windows | |
| CMD_BUILD: | | |
| uv run pyinstaller \ | |
| -n codelimit --onefile -c codelimit/__main__.py | |
| OUT_FILE_NAME: dist/codelimit.exe | |
| - os: ubuntu-22.04 | |
| TARGET: linux | |
| CMD_BUILD: | | |
| uv run pyinstaller \ | |
| -n codelimit -F codelimit/__main__.py | |
| mv dist/codelimit dist/codelimit-linux | |
| OUT_FILE_NAME: dist/codelimit-linux | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: uv sync --locked --dev | |
| - name: Build codelimit with pyinstaller for ${{matrix.TARGET}} | |
| run: ${{matrix.CMD_BUILD}} | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ format('v{0}', needs.release.outputs.version) }} | |
| files: | | |
| ${{ matrix.OUT_FILE_NAME }} |