Check version #14733
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: Check version | |
on: | |
push: | |
branches: [ "main" ] | |
schedule: | |
- cron: "*/5 * * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Upgrade pip | |
run: pip install --upgrade pip | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Run the script | |
id: run_script | |
run: | | |
output=$(python app_ver.py) | |
echo "app=$output" >> $GITHUB_ENV | |
- name: Ensure app_ver.txt exists | |
run: | | |
if [ ! -f app_ver.txt ]; then | |
echo "Creating app_ver.txt" | |
touch app_ver.txt | |
fi | |
- name: Update app_var.txt file | |
if: env.app != 'No update needed' | |
run: | | |
echo "status=run" >> $GITHUB_ENV | |
git config --global user.name "tzagim" | |
git config --global user.email "[email protected]" | |
git add app_ver.txt | |
git commit -m "Update version" | |
git push | |
- name: Trigger build Workflow | |
if: env.status == 'run' | |
uses: actions/github-script@v7 | |
with: | |
retries: 3 | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: 'build.yml', | |
ref: 'main', | |
}) | |
- name: Prevent workflow deactivation | |
uses: gautamkrishnar/keepalive-workflow@v2 | |
with: | |
committer_username: "tzagim" | |
committer_email: "[email protected]" |