-
-
Notifications
You must be signed in to change notification settings - Fork 9
32 lines (26 loc) · 969 Bytes
/
main_versioning.yml
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
name: Main Versioning
on:
pull_request:
types: [closed]
branches:
- main
jobs:
update_version:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update VERSION in main
run: |
# Attempt to remove the -DEV suffix from the version number if it exists
NEW_VERSION=$(sed -n 's/^VERSION=\"\(.*\)\(-DEV\)\?\"$/\1/p' scripts/controller.sh)
# Replace VERSION in the file with the NEW_VERSION value
sed -i "s/^VERSION=\".*\"$/VERSION=\"${NEW_VERSION}\"/" scripts/controller.sh
# Check if there are changes to commit
git diff --exit-code || {
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update version to ${NEW_VERSION}"
git push origin main
}