Skip to content

Commit

Permalink
ci: auto increase build number on pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
xfqwdsj committed Jan 27, 2024
1 parent 8f4c263 commit 27c3498
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/increase-build-number.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Increase build number on pull request

on:
pull_request:
branches:
- main

permissions:
contents: write

jobs:
increase-build-number:
name: Increase build number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Increase build number
run: |
buildNumber=$(grep buildNumber= build-number.properties | cut -d'=' -f2)
buildNumber=$((buildNumber+1))
sed -i "s/buildNumber=.*/buildNumber=$buildNumber/" build-number.properties
echo "buildNumber=$buildNumber"
- name: Commit and push changes
run: |
git add build-number.properties
git commit -m "chore: increase build number to $buildNumber"
git push

0 comments on commit 27c3498

Please sign in to comment.