-
-
Notifications
You must be signed in to change notification settings - Fork 8
51 lines (44 loc) · 1.97 KB
/
update-toast.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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