-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (31 loc) · 1.11 KB
/
increase-build-number.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Increase build number on pull request
on:
pull_request:
branches:
- main
permissions:
contents: write
jobs:
increase-build-number:
if: "!startsWith(github.event.pull_request.title, 'ci:')"
name: Increase build number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Increase build number
id: 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" >> $GITHUB_OUTPUT
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add build-number.properties
git commit -m "chore: increase build number to ${{ steps.increase-build-number.outputs.buildNumber }}"
git push