Update API and regenerate project #9
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: 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-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository with submodules | |
uses: actions/checkout@v4 | |
with: | |
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_ENV | |
else | |
echo "changes_detected=true" >> $GITHUB_ENV | |
fi | |
- name: Bump version | |
if: env.changes_detected == 'true' | |
run: | | |
python src/scripts/version_updater.py ./pyproject.toml patch | |
git add pyproject.toml | |
- name: Test | |
if: env.changes_detected == 'true' | |
run: | | |
tox | |
tox -e test_earliest | |
- name: Commit changes | |
if: env.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" | |
- name: Push changes | |
if: env.changes_detected == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force_with_lease: true |