ci(github): rename to release-please.yml #4
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-please | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - name: Release Please | |
| uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| release-type: python | |
| publish: | |
| needs: release | |
| if: ${{ needs.release.outputs.release_created }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/python-cli-template | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Use Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: pyproject.toml | |
| - name: Install build | |
| run: python -m pip install build | |
| - name: Build package | |
| run: python -m build | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| upload: | |
| needs: release | |
| if: ${{ needs.release.outputs.release_created }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Use Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: pyproject.toml | |
| - name: Install dependencies | |
| run: pip install -e '.[build]' | |
| - name: Build executable | |
| run: pyinstaller src/python_cli_template/cli.py --name python-cli-template --onefile --clean | |
| - name: Compress executable | |
| shell: bash | |
| run: | | |
| if [[ $RUNNER_OS == 'Windows' ]]; then | |
| 7z a -r archive.zip dist | |
| else | |
| zip -r archive.zip dist | |
| fi | |
| - name: Upload Release Artifact | |
| shell: bash | |
| run: | | |
| filename=$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]').zip | |
| mv archive.zip $filename | |
| gh release upload ${{ needs.release.outputs.tag_name }} $filename | |
| env: | |
| GH_TOKEN: ${{ github.token }} |