-
Notifications
You must be signed in to change notification settings - Fork 313
chore: improve registry-scanner/hack/create-release.sh #1157
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
Changes from 1 commit
c8d07ef
a16276e
0100ff1
d78e85f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0.111.0 | ||
| 0.1.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,29 +4,48 @@ | |
| # - install gh cli and semver-cli (go install github.com/davidrjonas/semver-cli@latest) | ||
| # - create and push "registry-scanner/release-X.Y" branch | ||
| # - checkout this branch locally | ||
| # - run this script from repo registry-scanner module: ./hack/create-release.sh [TARGET_VERSION] [REMOTE] | ||
| # - run this script from repo registry-scanner module: ./hack/create-release.sh [TARGET_VERSION] [MESSAGE] [REMOTE] | ||
| # - merge the PR | ||
| # Example Uses: | ||
| # `./hack/create-release.sh 0.1.1 "This is an example message"` Would create a new tag "registry-scanner/v0.1.1" with | ||
| # the message "This is an example message" and edit | ||
| # VERSION to be 0.1.1 which would be committed. | ||
| # | ||
| # `./hack/create-release.sh 0.1.X "TEST"` origin Would create a new tag "registry-scanner/v0.1.X" with | ||
| # the message "TEST" and edit VERSION to be 0.1.X which | ||
| # would be committed. The contents would be pushed to the | ||
| # remote "origin." | ||
|
||
|
|
||
| TARGET_VERSION="$1" | ||
| MESSAGE="$2" | ||
|
|
||
| USAGE_ERR=" USAGE: $0 [TARGET_VERSION] [MESSAGE] [REMOTE]" | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| # Validate if arguments are present | ||
| if test "${TARGET_VERSION}" = ""; then | ||
| echo "USAGE: $0 <version> <remote>" >&2 | ||
| printf "!! TARGET_VERSION is missing\n$USAGE_ERR\n" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if test "${MESSAGE}" = ""; then | ||
| printf "!! MESSAGE argument is missing\n$USAGE_ERR\n" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| CURRENT_BRANCH="$(git branch --show-current)" | ||
| SUBMODULE_NAME="registry-scanner" | ||
|
|
||
| if [[ ! "${CURRENT_BRANCH}" == registry-scanner/release-* ]]; then | ||
| echo "!! Please checkout branch 'registry-scanner/release-X.Y' (currently in branch: '${CURRENT_BRANCH}')" >&2 | ||
| exit 1 | ||
| fi | ||
| #if [[ ! "${CURRENT_BRANCH}" == registry-scanner/release-* ]]; then | ||
| # echo "!! Please checkout branch 'registry-scanner/release-X.Y' (currently in branch: '${CURRENT_BRANCH}')" >&2 | ||
| # exit 1 | ||
| #fi | ||
|
||
|
|
||
| RELEASE_BRANCH="${CURRENT_BRANCH}" | ||
|
|
||
| REMOTE=${2:-origin} | ||
| REMOTE=${3:-origin} | ||
| REMOTE_URL=$(git remote get-url "${REMOTE}") | ||
|
|
||
| if [[ ! $(git ls-remote --exit-code ${REMOTE_URL} ${RELEASE_BRANCH}) ]]; then | ||
|
|
@@ -47,7 +66,11 @@ fi | |
| echo "Creating tag ${NEW_TAG}" | ||
| echo "${TARGET_VERSION}" > VERSION | ||
|
|
||
| # Commit updated VERSION file | ||
| git add VERSION | ||
| git commit -s -m "automated: bump VERSION file to version ${TARGET_VERSION}" | ||
|
||
|
|
||
| # Create tag for registry-scanner | ||
| git tag "${NEW_TAG}" | ||
| git push "${REMOTE}" tag "${NEW_TAG}" | ||
| git tag -a "${NEW_TAG}" -m "${MESSAGE}" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. message can be the same as ${NEW_TAG} |
||
| git push "${REMOTE}" --follow-tags #tag "${NEW_TAG}" | ||
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentionally kept an unreal value. The real value is set in a release-* branch. See
https://github.com/argoproj-labs/argocd-image-updater/blob/release-0.16/VERSION
https://github.com/argoproj-labs/argocd-image-updater/blob/registry-scanner/release-0.1/registry-scanner/VERSION