From c6af3d3686e835a92936f7f84b39f8207e9af32c Mon Sep 17 00:00:00 2001 From: nyanotech Date: Fri, 16 Feb 2024 03:40:47 -0800 Subject: [PATCH] automatically merge to release branch when version number is incremented, hopefully --- .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c4cee26 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +on: + push: + branches: + - main + +name: Update release branch if version incremented +jobs: + check-version: + name: "Check version" + runs-on: ubuntu-latest + outputs: + output1: ${{ steps.bumped.outputs.test }} + steps: + - uses: actions/checkout@v4 + - name: Check if version bumped in package.json + id: bumped + run: 'if [ $(git blame -l package.json | grep "\"version\":" | cut -d " " -f 1) = $(git rev-parse HEAD) ]; then echo true > $GITHUB_OUTPUT; fi' + push-branch: + name: "Push branch" + needs: check-version + if: ${{ needs.bumped.outputs.output1 == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Push release branch + env: + OUTPUT: ${{ needs.bumped.outputs.output1 }} + run: ' + git branch -f release && + git push -f origin release + '