From b8c0499d1eaedb772be3cbf9686415cb837ea4b9 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Mon, 23 Dec 2019 05:51:44 +0900 Subject: [PATCH] chore: Add workflow --- .github/workflows/update-major-tag.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/update-major-tag.yml diff --git a/.github/workflows/update-major-tag.yml b/.github/workflows/update-major-tag.yml new file mode 100644 index 0000000..ffdae30 --- /dev/null +++ b/.github/workflows/update-major-tag.yml @@ -0,0 +1,24 @@ +name: Update major tag + +on: + release: + types: [published] + +jobs: + update: + runs-on: ubuntu-18.04 + steps: + + - uses: actions/checkout@v2 + + - name: Update major tag + if: github.event.release.prerelease == false + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" + export TAG_NAME="${GITHUB_REF##refs/tags/}" + export TAG_MAJOR="${TAG_NAME%%.*}" + git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || git tag -d "${TAG_MAJOR}" ; git push --delete origin "${TAG_MAJOR}" + git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || true + git push origin "${TAG_MAJOR}"