From eca1ab807dcf5555589e747fce2c76e0bea0dbda Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Tue, 9 Apr 2024 23:31:16 -0500 Subject: [PATCH] ci: add toast updater automator (#24) * ci: add toast updater automator * fix(infra): update package to not fail * ci: add dispatching for ci runs * ci: remove unused dispatch --- .github/workflows/update-toast.yml | 47 ++++++++++++++++++++++++++++++ src/litestar_dev/__init__.py | 0 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/update-toast.yml create mode 100644 src/litestar_dev/__init__.py diff --git a/.github/workflows/update-toast.yml b/.github/workflows/update-toast.yml new file mode 100644 index 0000000..119163f --- /dev/null +++ b/.github/workflows/update-toast.yml @@ -0,0 +1,47 @@ +name: Check Litestar Release + +on: + schedule: + - cron: '0 0 * * *' # Run every night at midnight + workflow_run: + workflows: ["Tests and Linting"] + types: + - completed + +jobs: + check_release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Get latest Litestar release + id: latest_release + run: | + latest_release=$(curl -s https://api.github.com/repos/litestar-org/litestar/releases/latest | jq -r '.tag_name') + echo "::set-output name=version::$latest_release" + + - name: Update conf.py + if: steps.latest_release.outputs.version != env.CURRENT_VERSION + env: + CURRENT_VERSION: v2.8.2 + run: | + sed -i "s/Litestar $CURRENT_VERSION/Litestar ${{ steps.latest_release.outputs.version }}/g" conf.py + sed -i "s|/release-notes/changelog.html#$CURRENT_VERSION|/release-notes/changelog.html#${{ steps.latest_release.outputs.version }}|g" conf.py + + - name: Update workflow file + if: steps.latest_release.outputs.version != env.CURRENT_VERSION + run: | + sed -i "s/CURRENT_VERSION: $CURRENT_VERSION/CURRENT_VERSION: ${{ steps.latest_release.outputs.version }}/g" .github/workflows/check-litestar-release.yml + + - name: Create pull request + if: steps.latest_release.outputs.version != env.CURRENT_VERSION + uses: peter-evans/create-pull-request@v3 + with: + commit-message: Update Litestar version to ${{ steps.latest_release.outputs.version }} + title: Update Litestar version to ${{ steps.latest_release.outputs.version }} + body: | + A new Litestar release (${{ steps.latest_release.outputs.version }}) has been detected. + This PR updates the version in the `conf.py` file and the `CURRENT_VERSION` in the workflow file. + branch: update-litestar-version diff --git a/src/litestar_dev/__init__.py b/src/litestar_dev/__init__.py new file mode 100644 index 0000000..e69de29