autoupdate #30
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 18 14,28 * *' # Git and Python packages | |
| - cron: '0 18 10 2-12/2 *' # Python release schedule | |
| workflow_dispatch: | |
| jobs: | |
| autoupdate: | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - 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 | |
| sed -E -i "s/3\.12\.[0-9]+/$python_version/g" README.md | |
| - name: Fetch latest uv release | |
| if: ${{ github.event.schedule == '0 18 14,28 * *' || github.event_name == 'workflow_dispatch' }} | |
| run: | | |
| uv_version=$(git ls-remote --tags https://github.com/astral-sh/uv | grep -o 'refs/tags/[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -n1 | sed 's/refs\/tags\///') | |
| echo "uv_version: $uv_version" | |
| sed -i "s/ENV UV_VERSION=.*/ENV UV_VERSION=$uv_version/" Dockerfile | |
| - name: Update Python 3.12 requirements | |
| if: ${{ github.event.schedule == '0 18 14,28 * *' || github.event_name == 'workflow_dispatch' }} | |
| uses: coatl-dev/actions/uv-pip-compile-upgrade@v5 | |
| with: | |
| path: requirements/3.12/pip.txt | |
| python-version: '3.12' | |
| - name: Extract package versions and update Dockerfile | |
| if: ${{ github.event.schedule == '0 18 14,28 * *' || github.event_name == 'workflow_dispatch' }} | |
| run: | | |
| pip312=$(grep '^pip==' requirements/3.12/pip.txt | cut -d '=' -f 3) | |
| echo "Extracted versions:" | |
| echo "pip3.12: $pip312" | |
| sed -i "s/ENV PYTHON312_PIP_VERSION=.*/ENV PYTHON312_PIP_VERSION=$pip312/" 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 }} |