Update models-dev.json #21
This file contains hidden or 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: 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 |