Skip to content

Commit

Permalink
Abort if a release for the same version is pending
Browse files Browse the repository at this point in the history
  • Loading branch information
carleeto committed Aug 9, 2023
1 parent a5e0d1b commit 1f27286
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/check-pending-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -e
set -x

VERSION=$(cat package.json | jq -r '.version')
CLONE_DIR="./imx-docs"
INPUT_DESTINATION_HEAD_BRANCH="ts-immutable-sdk-docs-$VERSION"

cd "$CLONE_DIR"
PENDING_RELEASE=$(git ls-remote --heads origin refs/heads/$INPUT_DESTINATION_HEAD_BRANCH)
if [ -n "$PENDING_RELEASE" ]; then
echo "There is already a pending release for v$VERSION"
echo "$INPUT_DESTINATION_HEAD_BRANCH already exists."
exit 1
fi

5 changes: 0 additions & 5 deletions .github/scripts/push-docs-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ else
PULL_REQUEST_REVIEWERS='-r '$INPUT_PULL_REQUEST_REVIEWERS
fi

# echo "CLONE_DIR: $CLONE_DIR"
# echo "Cloning destination git repository"
# # git clone "https://github.com/$INPUT_DESTINATION_REPO.git" "$CLONE_DIR"
# git clone "https://oauth2:[email protected]/$INPUT_DESTINATION_REPO.git" "$CLONE_DIR"

echo "Copying contents to git repo"
mkdir -p $INPUT_DESTINATION_FOLDER

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
path: imx-docs
ref: main

- name: Pending release check
run: ./.github/scripts/check-pending-release.sh
shell: bash

- name: Setup Github
run: |
git config --global user.name "${GITHUB_ACTOR}"
Expand Down

0 comments on commit 1f27286

Please sign in to comment.