Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup release-latest-versions #13

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions release-latest-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ done
do_release() {
local VERSION="$1"
local REPACK_VERSION="$2"
local SED_EXP
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused


VERSION="${VERSION#v}"

Expand All @@ -48,11 +47,11 @@ do_release() {

echo "Releasing v${VERSION}..."

# replace the version of wpackagist-plugin/wp-graphql in composer.json with $VERSION
contents="$(jq --arg version $VERSION '.require."wpackagist-plugin/wp-graphql" = $version' < source/composer.json)" && \
echo -E "${contents}" > source/composer.json
# Replace the version of wpackagist-plugin/wp-graphql in composer.json with $VERSION
contents="$(jq --arg version "${VERSION}" '.require."wpackagist-plugin/wp-graphql" = $version' < source/composer.json)" \
&& echo "${contents}" > source/composer.json
Comment on lines +51 to +52
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it safe and indent line


echo "$(cat source/composer.json)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless echo

cat source/composer.json

composer update --working-dir=source

Expand All @@ -71,13 +70,13 @@ do_release() {
git tag "v${VERSION}+repack.${REPACK_VERSION}"

# Delete the old git tag.
echo "Deleting old tag v${VERSION}"
echo "Deleting old tag v${VERSION}"
git tag -d "v${VERSION}"

# Delete the old tag on GitHub.
if [ -z "${DRY_RUN}" ]; then
git push --delete origin "v${VERSION}"
echo "Tag deleted from server."
echo "Tag deleted from GitHub."
fi
fi

Expand All @@ -87,7 +86,7 @@ do_release() {
git push --tags
git pull
git pull --tags
echo "Tags synced"
echo "Tags synced."
else
echo "Dry run, not pushing to GitHub"
git push --dry-run --tags
Expand Down Expand Up @@ -123,18 +122,17 @@ for POSSIBLE_VERSION in ${POSSIBLE_VERSIONS}; do
if git rev-parse "refs/tags/${POSSIBLE_VERSION}" >/dev/null 2>&1; then
echo "Tag exists!"

#
if [ -z "${SHOULD_RERELEASE}" ]; then
echo "Skipping"
continue
fi

# If SHOULD_RERELEASE is true, append -r1, -r2, etc.
for i in {1..100}; do
for REPACK in {1..100}; do
Comment on lines -133 to +131
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# If the tag doesn't exist, release it
if ! git rev-parse "refs/tags/${POSSIBLE_VERSION}+repack.${i}" >/dev/null 2>&1; then
echo "Rereleasing as ${POSSIBLE_VERSION}+repack.${i}"
do_release "${POSSIBLE_VERSION}" "${i}"
if ! git rev-parse "refs/tags/${POSSIBLE_VERSION}+repack.${REPACK}" >/dev/null 2>&1; then
echo "Rereleasing as ${POSSIBLE_VERSION}+repack.${REPACK}"
do_release "${POSSIBLE_VERSION}" "${REPACK}"
break
fi
done
Expand Down