build-bump #69
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: "build-bump" | |
on: | |
workflow_dispatch: # allows manual triggering | |
schedule: | |
- cron: '0 0 * * *' # runs daily at 00:00 | |
jobs: | |
opensb-bump: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required to count the commits | |
- name: Calculate days after April 24th 2021 | |
run: echo "OPENSB_VERSION=$(( ($(date +%s) - $(date --date="21-04-24" +%s) )/(60*60*24) ))" >> $GITHUB_ENV | |
- name: Get new commits | |
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV | |
- name: Overwrite file | |
uses: "slegare/write-file-action@master" | |
if: ${{ env.NEW_COMMIT_COUNT > 0 }} | |
with: | |
path: private/class/version.php | |
write-mode: overwrite | |
contents: | | |
<?php $buildNumber = ${{ env.OPENSB_VERSION }}; ?> | |
- name: Commit & Push | |
uses: Andro999b/[email protected] | |
if: ${{ env.NEW_COMMIT_COUNT > 0 }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
force: true | |
message: 'Bump build number' |