Check Litestar Release #243
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: Check Litestar Release | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run every night at midnight | |
workflow_run: | |
workflows: ["Tests and Linting"] | |
types: | |
- completed | |
jobs: | |
check_release: | |
permissions: | |
contents: write | |
pull-requests: write | |
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' | sed 's/^v//') | |
echo "::set-output name=version::$latest_release" | |
- name: Update docs/conf.py | |
if: steps.latest_release.outputs.version != env.CURRENT_VERSION | |
env: | |
CURRENT_VERSION: 2.12.1 | |
run: | | |
sed -Ei "s/(\"title\": \"Litestar )[[:digit:].]*( has just been released!\")/\1${{ steps.latest_release.outputs.version }}\2/" page/conf.py | |
sed -Ei "s|(https://docs.litestar.dev/latest/release-notes/changelog.html#)[[:digit:].]*|\1${{ steps.latest_release.outputs.version }}|" page/conf.py | |
- name: Update workflow file | |
if: steps.latest_release.outputs.version != env.CURRENT_VERSION | |
run: | | |
sed -Ei "s/(CURRENT_VERSION: )[[:digit:].]+/\1${{ steps.latest_release.outputs.version }}/" .github/workflows/update-toast.yml | |
- name: Create pull request | |
if: steps.latest_release.outputs.version != env.CURRENT_VERSION | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.WORKFLOW_TOKEN }} | |
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 `page/conf.py` file and the `CURRENT_VERSION` in the workflow file. | |
branch: update-litestar-version |