-
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (72 loc) · 3.32 KB
/
auto-update.yml
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
name: auto-update
on:
schedule:
- cron: '0 12 * * 0,4'
- cron: '0 18 14,28 * *' # Git
- cron: '0 18 10 2-12/2 *' # Python release schedule
workflow_dispatch:
jobs:
auto-update:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Fetch latest Git release
if: ${{ github.event.schedule == '0 18 14,28 * *' || github.event_name == 'workflow_dispatch' }}
run: |
git_version=$(git ls-remote --tags https://github.com/git/git | grep -o 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -n1 | sed 's/refs\/tags\///' | sed 's/^v//')
echo "git_version: $git_version"
sed -i "s/ENV GIT_VERSION=.*/ENV GIT_VERSION=$git_version/" Dockerfile
- 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 PYTHON312_VERSION=.*/ENV PYTHON312_VERSION=$python_version/" Dockerfile
- name: Fetch latest Python 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 "python: $python_version"
sed -i "s/ENV PYTHON_VERSION=.*/ENV PYTHON_VERSION=$python_version/" Dockerfile
- name: Update requirements
uses: coatl-dev/actions/pip-compile@v3
with:
path: requirements/3.12/pip.txt
python-version: '3.12'
- name: Update requirements
uses: coatl-dev/actions/pip-compile@v3
with:
path: requirements/pip.txt
python-version: '3.13'
- name: Extract package versions and update Dockerfile
run: |
pip312=$(grep '^pip==' requirements/3.12/pip.txt | cut -d '=' -f 3)
pip=$(grep '^pip==' requirements/pip.txt | cut -d '=' -f 3)
echo "Extracted versions:"
echo "pip3.12: $pip312"
echo "pip: $pip"
sed -i "s/ENV PYTHON312_PIP_VERSION=.*/ENV PYTHON312_PIP_VERSION=$pip312/" Dockerfile
sed -i "s/ENV PYTHON_PIP_VERSION=.*/ENV PYTHON_PIP_VERSION=$pip/" Dockerfile
- name: Detect changes
id: git-diff
uses: coatl-dev/actions/simple-git-diff@v3
- name: Import GPG key
if: ${{ steps.git-diff.outputs.diff == 'true' }}
id: gpg-import
uses: coatl-dev/actions/gpg-import@v3
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@v3
with:
gh-token: ${{ secrets.COATL_BOT_GH_TOKEN }}