autoupdate #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: autoupdate | |
on: | |
schedule: | |
- cron: '0 0 14,28 * *' | |
- cron: '0 18 10 2-12/2 *' | |
workflow_dispatch: | |
jobs: | |
autoupdate: | |
runs-on: blacksmith-2vcpu-ubuntu-2404 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- 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: Update requirements | |
uses: coatl-dev/actions/pip-compile-upgrade@v4 | |
with: | |
path: requirements/3.12 | |
python-version: '3.12' | |
- name: Update requirements | |
uses: coatl-dev/actions/pip-compile-upgrade@v4 | |
with: | |
path: requirements/3.13 | |
python-version: '3.13' | |
- 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) | |
echo "Extracted versions:" | |
echo "pip3.12: $pip312" | |
echo "pip3.13: $pip313" | |
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 | |
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 | |
- name: Detect changes | |
id: git-diff | |
uses: coatl-dev/actions/simple-git-diff@v4 | |
- name: Import GPG key | |
if: ${{ steps.git-diff.outputs.diff == 'true' }} | |
id: gpg-import | |
uses: coatl-dev/actions/gpg-import@v4 | |
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@v4 | |
with: | |
gh-token: ${{ secrets.COATL_BOT_GH_TOKEN }} |