-
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (88 loc) · 4.58 KB
/
autoupdate.yml
File metadata and controls
108 lines (88 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: autoupdate
on:
schedule:
- cron: '0 0 14,28 * *'
- cron: '0 18 10 2-12/2 *'
workflow_dispatch:
jobs:
autoupdate:
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Fetch latest Python 3.12 release
if: ${{ github.event.schedule == '0 18 10 2-12/2 *' || github.event_name == 'workflow_dispatch' }}
run: |
python_version=$(curl -s https://www.python.org/ftp/python/ | grep -oP '3\.12\.\d+/' | uniq | sort -V | tail -n 1 | tr -d '/')
echo "python3.12: $python_version"
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.12/bookworm/Dockerfile
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.12/slim-bookworm/Dockerfile
sed -i "s/3\.12\.[0-9]\+\([-a-z]*\)/$python_version\1/g" README.md
- name: Fetch latest Python 3.13 release
if: ${{ github.event.schedule == '0 18 10 2-12/2 *' || github.event_name == 'workflow_dispatch' }}
run: |
python_version=$(curl -s https://www.python.org/ftp/python/ | grep -oP '3\.13\.\d+/' | uniq | sort -V | tail -n 1 | tr -d '/')
echo "python3.13: $python_version"
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.13/bookworm/Dockerfile
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.13/slim-bookworm/Dockerfile
sed -i "s/3\.13\.[0-9]\+\([-a-z]*\)/$python_version\1/g" README.md
- name: Fetch latest Python 3.14 release
if: ${{ github.event.schedule == '0 18 10 2-12/2 *' || github.event_name == 'workflow_dispatch' }}
run: |
python_version=$(curl -s https://www.python.org/ftp/python/ | grep -oP '3\.14\.\d+/' | uniq | sort -V | tail -n 1 | tr -d '/')
echo "python3.14: $python_version"
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.14/bookworm/Dockerfile
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" 3.14/slim-bookworm/Dockerfile
sed -i "s/3\.14\.[0-9]\+\([-a-z]*\)/$python_version\1/g" README.md
- name: Update 3.12 requirements
uses: coatl-dev/actions/uv-pip-compile-upgrade@v5
with:
path: requirements/3.12
python-version: '3.12'
- name: Update 3.13 requirements
uses: coatl-dev/actions/uv-pip-compile-upgrade@v5
with:
path: requirements/3.13
python-version: '3.13'
- name: Update 3.14 requirements
uses: coatl-dev/actions/uv-pip-compile-upgrade@v5
with:
path: requirements/3.14
python-version: '3.14'
- name: Extract package versions and update Dockerfile
run: |
pip312=$(grep '^pip==' requirements/3.12/pip.txt | cut -d'=' -f3)
pip313=$(grep '^pip==' requirements/3.13/pip.txt | cut -d'=' -f3)
pip314=$(grep '^pip==' requirements/3.14/pip.txt | cut -d'=' -f3)
echo "Extracted versions:"
echo "pip3.12: $pip312"
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip312/" 3.12/bookworm/Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip312/" 3.12/slim-bookworm/Dockerfile
echo "pip3.13: $pip313"
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip313/" 3.13/bookworm/Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip313/" 3.13/slim-bookworm/Dockerfile
echo "pip3.14: $pip314"
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip314/" 3.14/bookworm/Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip314/" 3.14/slim-bookworm/Dockerfile
- name: Detect changes
id: git-diff
uses: coatl-dev/actions/simple-git-diff@v5
- name: Import GPG key
if: ${{ steps.git-diff.outputs.diff == 'true' }}
id: gpg-import
uses: coatl-dev/actions/gpg-import@v5
with:
passphrase: ${{ secrets.COATL_BOT_GPG_PASSPHRASE }}
private-key: ${{ secrets.COATL_BOT_GPG_PRIVATE_KEY }}
- name: Commit and push changes
if: ${{ steps.git-diff.outputs.diff == 'true' }}
run: |
git checkout -B coatl-dev-autoupdate
git add -u
git commit -m 'feat: update toolset'
git push --force --set-upstream origin coatl-dev-autoupdate
- name: Create Pull Request
if: ${{ steps.git-diff.outputs.diff == 'true' }}
uses: coatl-dev/actions/pr-create@v5
with:
gh-token: ${{ secrets.COATL_BOT_GH_TOKEN }}