auto-update #37
This file contains 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: 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 }} |