Github action报错Error: Version 3.9.17 with arch x64 not found
Run actions/setup-python@v1
Error: Version 3.9.17 with arch x64 not found
Available versions:
3.10.13 (x64)
3.11.5 (x64)
3.7.17 (x64)
3.8.18 (x64)
3.9.18 (x64)
主要就是python-version
这一块,GitHub会不定期更新版本号
jobs:
project:
runs-on: ubuntu-latest
steps:
- name: 'Checkout codes'
uses: actions/checkout@v2
- name: 'Set python'
uses: actions/setup-python@v1
with:
python-version: '3.9.17'
- name: 'Install dependencies'
...
...
所以就想着能不能自动获取版本号,按照下面这样就可以了
jobs:
tieba_sign:
runs-on: ubuntu-latest
steps:
- name: 'Checkout codes'
uses: actions/checkout@v2
- name: 'Find latest Python version'
id: find-python-version
run: |
latest_version=$(curl -s https://www.python.org/downloads/ | grep -Eo 'Python [0-9]+\.[0-9]+\.[0-9]+' | head -n 1 | awk '{print $2}')
echo "Latest Python version is $latest_version"
echo "::set-output name=python-version::$latest_version"
shell: bash
- name: 'Set up Python'
uses: actions/setup-python@v2
with:
python-version: ${{ steps.find-python-version.outputs.python-version }}
- name: 'Install dependencies'
...
...