--- name: CI on: push: pull_request: schedule: - cron: '30 0 * * 1' jobs: test: name: Run unit tests runs-on: ubuntu-latest strategy: matrix: python: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout source code uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install dependencies run: python -m pip install tox - name: Run unit tests (via tox) # Run tox using the version of Python in `PATH` run: tox -e py lint: name: Run linters runs-on: ubuntu-latest steps: - name: Checkout source code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install dependencies run: python -m pip install tox - name: Run linters (via tox) # Run tox using the version of Python in `PATH` run: tox -e lint release: name: Upload release artifacts runs-on: ubuntu-latest needs: test if: github.event_name == 'push' environment: name: pypi url: https://pypi.org/p/click-man permissions: id-token: write steps: - name: Checkout source code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install dependencies run: python -m pip install build - name: Build a binary wheel and a source tarball run: python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 - name: Create release on GitHub id: create_release if: startsWith(github.ref, 'refs/tags') uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: ${{ github.ref }} draft: false prerelease: false - name: Add sdist to release id: upload-release-asset if: startsWith(github.ref, 'refs/tags') uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/git-pw-${{ github.ref }}.tar.gz asset_name: git-pw-${{ github.ref }}.tar.gz asset_content_type: application/gzip