From c16b64f18025c5878ead584717ef11b95ebd5e61 Mon Sep 17 00:00:00 2001 From: Hongxin Date: Mon, 6 Jun 2022 08:55:39 -0500 Subject: [PATCH] Add action to update release draft version level --- .github/workflows/after-master-commit.yml | 40 +++++++++++++++++++++++ .version-level | 1 + 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/after-master-commit.yml create mode 100644 .version-level diff --git a/.github/workflows/after-master-commit.yml b/.github/workflows/after-master-commit.yml new file mode 100644 index 0000000..6aab5b7 --- /dev/null +++ b/.github/workflows/after-master-commit.yml @@ -0,0 +1,40 @@ +name: After master commit + +on: + push: + branches: + - master + +jobs: + check-version-level-and-update: + if: github.repository == 'oncokb/oncokb-annotator' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: 'Update Version Level' + run: | + git pull + VERSION_LEVEL=$(cat .version-level | tr "[:upper:]" "[:lower:]") + + RELEASE_DRAFTER_MINOR='NEXT_MINOR_VERSION' + RELEASE_DRAFTER_PATCH='NEXT_PATCH_VERSION' + + if [[ $VERSION_LEVEL == 'minor' ]]; then + sed -i "s/$RELEASE_DRAFTER_PATCH/$RELEASE_DRAFTER_MINOR/gi" .github/release-drafter.yml + fi + + if [[ $VERSION_LEVEL == 'patch' ]]; then + sed -i "s/$RELEASE_DRAFTER_MINOR/$RELEASE_DRAFTER_PATCH/gi" .github/release-drafter.yml + fi + + CHANGED=$(git diff --name-only HEAD --) + if [ -n "$CHANGED" ] + then + git config user.name oncokb-bot + git config user.email dev.oncokb@gmail.com + git add . + git commit -m "Update action files to align the version level to $VERSION_LEVEL" + git push + fi diff --git a/.version-level b/.version-level new file mode 100644 index 0000000..acb503f --- /dev/null +++ b/.version-level @@ -0,0 +1 @@ +minor