From 66afd413c3d175fefbfd9a4b51d64ac64f951e65 Mon Sep 17 00:00:00 2001 From: Erez Rokah Date: Wed, 9 Sep 2020 05:11:56 -0700 Subject: [PATCH] chore: add revert failed publish command (#4282) --- .github/workflows/publish.yml | 1 + scripts/revert_publish.sh | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100755 scripts/revert_publish.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1848d70f..e7d2fdca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -66,3 +66,4 @@ jobs: CODE_PATTERN: 'Enter OTP' # 40 minutes for the entire command, 20 minutes for waiting for 2FA TIMEOUT: '2400000' + REVERT_COMMAND: './scripts/revert_publish.sh' diff --git a/scripts/revert_publish.sh b/scripts/revert_publish.sh new file mode 100755 index 00000000..afde2a08 --- /dev/null +++ b/scripts/revert_publish.sh @@ -0,0 +1,10 @@ +publishCommit=$(git --no-pager log -1 --pretty=format:"%H" --grep="^chore(release): publish$") +ref=$(git tag -l --points-at $publishCommit) +echo "reverting publish commit $publishCommit" +echo "deleting tags $ref" +git push --delete origin $ref +echo "reverting commit $publishCommit" +git revert --no-edit $publishCommit +echo "pushing changes" +git push origin master +echo "done reverting publish" \ No newline at end of file