File tree Expand file tree Collapse file tree 1 file changed +31
-2
lines changed
Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,42 @@ jobs:
3131
3232 - uses : actions/checkout@v3
3333
34- - name : Setup python
35- id : python
34+ # Python 2.7 was removed from actions/setup-python https://github.com/actions/setup-python/issues/672
35+ - name : Set up Python ${{ matrix.python-version }}
36+ if : matrix.python-version != '2.7'
3637 uses : actions/setup-python@v4
38+ id : setup-python
3739 with :
3840 python-version : ${{ matrix.python-version }}
3941 architecture : x64
4042
43+ - name : Set up Python ${{ matrix.python-version }}
44+ if : matrix.python-version == '2.7' && matrix.os == 'ubuntu-20.04'
45+ run : |
46+ sudo apt install -y python2
47+ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
48+ sudo python2 get-pip.py
49+ id : apt-install-python
50+
51+ - name : Set up Python ${{ matrix.python-version }}
52+ if : matrix.python-version == '2.7' && matrix.os == 'windows-latest'
53+ run : |
54+ choco install python2
55+ id : choco-install-python
56+ shell : pwsh
57+
58+ - name : Configure steps.python.outputs
59+ run : |
60+ if (Test-Path "${{ steps.setup-python.outputs.python-path }}") {
61+ "python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
62+ } elseif (Test-Path C:/Python27/python.exe) {
63+ "python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
64+ } else {
65+ "python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
66+ }
67+ id : python
68+ shell : pwsh
69+
4170 # Cannot use https://github.com/ilammy/msvc-dev-cmd/blob/a742a854f54111d83b78e97091b5d85ccdaa3e89/index.js#L163
4271 # as (unapproved) 3rd party GitHub Actions are forbidden on Apache org projects
4372
You can’t perform that action at this time.
0 commit comments