🔧 fix(ci): set fetch-depth to 0 for release job #171
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
| name: CI | |
| on: | |
| push: | |
| branches: ["**"] | |
| tags: ["v*"] | |
| pull_request: | |
| defaults: | |
| run: | |
| shell: bash | |
| concurrency: | |
| group: ci-tests-${{ github.ref }}-1 | |
| cancel-in-progress: true | |
| jobs: | |
| run_tests: | |
| name: Run Tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system dependencies (Ubuntu) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libpulse0 p7zip-full libasound2t64 | |
| - name: Install system dependencies (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: choco install 7zip | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache Hatch environments (Linux) | |
| if: runner.os == 'Linux' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local/share/hatch | |
| key: ${{ runner.os }}-${{ matrix.python-version }}-hatch-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.python-version }}-hatch- | |
| - name: Cache Hatch environments (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\AppData\Local\hatch | |
| key: ${{ runner.os }}-${{ matrix.python-version }}-hatch-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.python-version }}-hatch- | |
| - name: Install Hatch | |
| run: pip install hatch | |
| - name: Install dependencies | |
| run: hatch env create default | |
| - name: Install dev dependencies | |
| run: hatch env create dev | |
| - name: Download TeamTalk SDK | |
| run: hatch run sdk-download | |
| - name: Run a basic import test | |
| run: hatch run python -c "import pytalk" | |
| - name: Run precommit and all checks | |
| run: hatch run dev:check | |
| build_pytalk: | |
| name: Build pytalk | |
| needs: [run_tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Hatch | |
| uses: pypa/hatch@install | |
| - name: Build wheel | |
| run: hatch build | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| retention-days: 1 | |
| publish_to_pypi: | |
| name: Publish to PyPI | |
| needs: [build_pytalk] | |
| if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify tag commit is on master | |
| run: | | |
| git fetch origin master | |
| git merge-base --is-ancestor $GITHUB_SHA origin/master || { | |
| echo "::error::Tagged commit is not on master. Aborting release."; | |
| exit 1; | |
| } | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true``` |