-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (44 loc) · 1.47 KB
/
update-models.yml
File metadata and controls
50 lines (44 loc) · 1.47 KB
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
name: Update models-dev.json
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- name: Save old models-dev.json
run: cp models-dev.json models-dev.old.json
- name: Run get_models.sh
run: bash bin/get_models.sh
- name: Commit and release if changed
env:
GH_TOKEN: ${{ github.token }}
run: |
git diff --quiet models-dev.json && exit 0
python3 bin/diff_models.py models-dev.old.json models-dev.json > /tmp/release_notes.md
BREAKING=$(python3 bin/diff_models.py --breaking models-dev.old.json models-dev.json)
git config user.name "Fabien Potencier"
git config user.email "fabien@potencier.org"
git add models-dev.json
git commit -m "Update models-dev.json"
LAST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
if [ -z "$LAST_TAG" ]; then
NEXT_TAG="v1.0"
else
VERSION=${LAST_TAG#v}
MAJOR=${VERSION%%.*}
MINOR=${VERSION#*.}
if [ "$BREAKING" = "true" ]; then
NEXT_TAG="v$((MAJOR + 1)).0"
else
NEXT_TAG="v${MAJOR}.$((MINOR + 1))"
fi
fi
git push
gh release create "$NEXT_TAG" --title "$NEXT_TAG" --notes-file /tmp/release_notes.md