From e80bd05075dc8fc83697ba401dff1faba83bcd27 Mon Sep 17 00:00:00 2001 From: Dan Brodjieski Date: Tue, 21 May 2024 08:43:05 -0400 Subject: [PATCH] feat: add version workflow --- .github/workflows/versioner.yml | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/versioner.yml diff --git a/.github/workflows/versioner.yml b/.github/workflows/versioner.yml new file mode 100644 index 000000000..ff3c15d97 --- /dev/null +++ b/.github/workflows/versioner.yml @@ -0,0 +1,41 @@ +############################################################################# +# GitHub Action to bump build number +# +############################################################################# +name: "Bump build number on OS branch push" +on: + push: + branches: + - 'dev_sonoma_compscript' + # - '!dev*' + # - '!main' +jobs: + bump: + name: Bump build + runs-on: ubuntu-latest + steps: + - name: Checkout the latest code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Update VERSION.yaml with newest build number + id: new_build + run: | + CURRENT_BUILD=$(awk '/^build/ { print $NF }' VERSION.yaml) + if [[ -z $CURRENT_BUILD ]];then + echo "build: 1" >> VERSION.yaml + echo "::set-output name=NEWBUILD::1" + else + NEW_BUILD=$((CURRENT_BUILD+1)) + + echo "$NEW_BUILD" + echo "::set-output name=NEWBUILD::$NEW_BUILD" + sed -i "s/^build.*/build: $NEW_BUILD/" VERSION.yaml + fi + - name: Push commit + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add VERSION.yaml + git commit -am "minor: Bump build to ${{ steps.new_build.outputs.NEWBUILD }}" + git push \ No newline at end of file