Skip to content

auto-update

auto-update #26

Workflow file for this run

name: auto-update
on:
schedule:
- cron: '30 18 * * 0,4' # Python packages
- cron: '0 18 14,28 * *' # Git
- cron: '0 18 10 2-12/2 *' # Python 3.12 release schedule; see: https://peps.python.org/pep-0693/#bugfix-releases
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: |
python3_version=$(curl -s https://www.python.org/ftp/python/ | grep -oP '3\.12\.\d+/' | uniq | sort -V | tail -n 1 | tr -d '/')
echo "python312: $python3_version"
sed -i "s/ENV PYTHON3_VERSION=.*/ENV PYTHON3_VERSION=$python3_version/" Dockerfile
- name: Update requirements
uses: coatl-dev/actions/pip-compile@v3
with:
path: requirements
- name: Detect changes
id: git-diff
uses: coatl-dev/actions/simple-git-diff@v3
- name: Extract package versions and update Dockerfile
if: ${{ steps.git-diff.outputs.diff == 'true' }}
run: |
pip_version=$(grep '^pip==' requirements/base.txt | cut -d'=' -f3)
setuptools_version=$(grep '^setuptools==' requirements/base.txt | cut -d'=' -f3)
wheel_version=$(grep '^wheel==' requirements/base.txt | cut -d'=' -f3)
echo "Extracted versions:"
echo "pip: $pip_version"
echo "setuptools: $setuptools_version"
echo "wheel: $wheel_version"
sed -i "s/ENV PYTHON3_PIP_VERSION=.*/ENV PYTHON3_PIP_VERSION=$pip_version/" Dockerfile
sed -i "s/ENV PYTHON3_SETUPTOOLS_VERSION=.*/ENV PYTHON3_SETUPTOOLS_VERSION=$setuptools_version/" Dockerfile
sed -i "s/ENV PYTHON3_WHEEL_VERSION=.*/ENV PYTHON3_WHEEL_VERSION=$wheel_version/" Dockerfile
- 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 'chore(python3): update requirements'
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 }}