upgrade actions/checkout to v5 and actions/setup-python to v6 in advanced-usage.md

Updated GitHub Actions to use newer versions of checkout and setup-python actions.
This commit is contained in:
priya-kinthali 2025-08-26 14:05:58 +05:30 committed by GitHub
parent c7178f6209
commit 4f6f36c9a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,8 +32,8 @@ If there is a specific version of Python that you need and you don't want to wor
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.12.6' python-version: '3.12.6'
- run: python my_script.py - run: python my_script.py
@ -46,8 +46,8 @@ You can specify **only a major and minor version** if you are okay with the most
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
- run: python my_script.py - run: python my_script.py
@ -60,8 +60,8 @@ You can specify the version with **prerelease tag** to download and set up an ac
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.14.0-alpha.1' python-version: '3.14.0-alpha.1'
- run: python my_script.py - run: python my_script.py
@ -71,8 +71,8 @@ It's also possible to use **x.y-dev syntax** to download and set up the latest p
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.14-dev' python-version: '3.14-dev'
- run: python my_script.py - run: python my_script.py
@ -84,8 +84,8 @@ Free threaded Python is only available starting with the 3.13 release.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13t' python-version: '3.13t'
- run: python my_script.py - run: python my_script.py
@ -95,8 +95,8 @@ Note that the **t** suffix is not `semver` syntax. If you wish to specify a rang
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '>=3.13' python-version: '>=3.13'
freethreaded: true freethreaded: true
@ -109,8 +109,8 @@ You can also use several types of ranges that are specified in [semver](https://
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '>=3.9 <3.14' python-version: '>=3.9 <3.14'
- run: python my_script.py - run: python my_script.py
@ -120,8 +120,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13.0-alpha - 3.13.0' python-version: '3.13.0-alpha - 3.13.0'
- run: python my_script.py - run: python my_script.py
@ -131,8 +131,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.x' python-version: '3.x'
- run: python my_script.py - run: python my_script.py
@ -164,8 +164,8 @@ jobs:
- 'pypy3.10' # the latest available version of PyPy that supports Python 3.10 - 'pypy3.10' # the latest available version of PyPy that supports Python 3.10
- 'pypy3.10-v7.3.17' # Python 3.10 and PyPy 7.3.17 - 'pypy3.10-v7.3.17' # Python 3.10 and PyPy 7.3.17
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- run: python my_script.py - run: python my_script.py
@ -182,8 +182,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: | python-version: |
3.11 3.11
@ -199,8 +199,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: | python-version: |
pypy-3.10-v7.3.x pypy-3.10-v7.3.x
@ -216,8 +216,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: | python-version: |
3.11 3.11
@ -241,9 +241,9 @@ jobs:
python-version: ['3.x', 'pypy3.8', 'pypy3.9' ] python-version: ['3.x', 'pypy3.8', 'pypy3.9' ]
name: Python ${{ matrix.python-version }} sample name: Python ${{ matrix.python-version }} sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
architecture: x64 architecture: x64
@ -267,9 +267,9 @@ jobs:
- os: windows-latest - os: windows-latest
python-version: '3.9' python-version: '3.9'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Display Python version - name: Display Python version
@ -285,8 +285,8 @@ jobs:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version-file: '.python-version' # Read python version from a file .python-version python-version-file: '.python-version' # Read python version from a file .python-version
- run: python my_script.py - run: python my_script.py
@ -294,8 +294,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version-file: 'pyproject.toml' # Read python version from a file pyproject.toml python-version-file: 'pyproject.toml' # Read python version from a file pyproject.toml
- run: python my_script.py - run: python my_script.py
@ -303,8 +303,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version-file: '.tool-versions' # Read python version from a file .tool-versions python-version-file: '.tool-versions' # Read python version from a file .tool-versions
- run: python my_script.py - run: python my_script.py
@ -312,8 +312,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version-file: 'Pipfile' # Read python version from a file Pipfile python-version-file: 'Pipfile' # Read python version from a file Pipfile
- run: python my_script.py - run: python my_script.py
@ -327,8 +327,8 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
check-latest: true check-latest: true
@ -342,8 +342,8 @@ steps:
**Caching pipenv dependencies:** **Caching pipenv dependencies:**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
cache: 'pipenv' cache: 'pipenv'
@ -355,10 +355,10 @@ steps:
**Caching poetry dependencies:** **Caching poetry dependencies:**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Install poetry - name: Install poetry
run: pipx install poetry run: pipx install poetry
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
cache: 'poetry' cache: 'poetry'
@ -370,8 +370,8 @@ steps:
**Using a list of file paths to cache dependencies** **Using a list of file paths to cache dependencies**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
cache: 'pipenv' cache: 'pipenv'
@ -385,8 +385,8 @@ steps:
**Using wildcard patterns to cache dependencies** **Using wildcard patterns to cache dependencies**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
cache: 'pip' cache: 'pip'
@ -397,8 +397,8 @@ steps:
**Using a list of wildcard patterns to cache dependencies** **Using a list of wildcard patterns to cache dependencies**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
cache: 'pip' cache: 'pip'
@ -412,8 +412,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
cache: 'pip' cache: 'pip'
@ -435,8 +435,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
id: cp312 id: cp312
with: with:
python-version: "3.9.0 - 3.12.0" python-version: "3.9.0 - 3.12.0"
@ -452,8 +452,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
id: cp313 id: cp313
with: with:
python-version: "3.13" python-version: "3.13"
@ -468,8 +468,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
id: cp313 id: cp313
with: with:
python-version: "3.13.0" python-version: "3.13.0"
@ -499,8 +499,8 @@ Such a requirement on side-effect could be because you don't want your composite
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
id: cp313 id: cp313
with: with:
python-version: '3.13' python-version: '3.13'
@ -645,8 +645,8 @@ jobs:
python_version: ["3.11", "3.12", "3.13"] python_version: ["3.11", "3.12", "3.13"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-python@v5 - uses: actions/setup-python@v6
with: with:
python-version: "${{ matrix.python_version }}" python-version: "${{ matrix.python_version }}"
allow-prereleases: true allow-prereleases: true
@ -660,9 +660,9 @@ The version of Pip should be specified in the format `major`, `major.minor`, or
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
pip-version: '25.0.1' pip-version: '25.0.1'