Skip to content

Update API and regenerate project #26

Update API and regenerate project

Update API and regenerate project #26

Workflow file for this run

name: Update API and regenerate project
on:
workflow_dispatch: # Manual trigger
repository_dispatch: # when triggered remotely
types:
- api_published # trigger name
# push:
# paths:
# - 'nebius-api'
# - 'nebius-api/**'
jobs:
update:
runs-on: ubuntu-latest
outputs:
changes_detected: ${{ steps.check_changes.outputs.changes_detected }}
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.AUTOCOMMITTER_PRIVATE_KEY }}
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[generators,dev]
pip install tox
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
setup_only: true
- name: Run generation script
run: |
make
- name: Check for Changes
id: check_changes
run: |
git add .
if git diff --cached --quiet; then
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Bump version
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
python src/scripts/version_updater.py ./pyproject.toml patch
git add pyproject.toml
- name: Test
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
tox
tox -e test_earliest
- name: Commit changes
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Auto-update API to: $(git -C nebius-api log -1 --format='%h, %ci')"
- name: Push and pull changes
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
git push origin main
git pull
git status
git branch -r --contains HEAD
- name: Tag commit
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
make tag-ver
- name: Push changes
if: steps.check_changes.outputs.changes_detected == 'true'
uses: ad-m/github-push-action@master
with:
tags: true
ssh: true
force_with_lease: true
# Probably no need, as the release will be triggered by the tag
# release:
# if: ${{ needs.update.outputs.changes_detected == 'true' }}
# needs: update
# uses: ./.github/workflows/release.yml