@@ -16,6 +16,13 @@ source ./scripts/lib/common.sh
1616SCRIPTS_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
1717WORKSPACE_DIR=$( realpath " $SCRIPTS_DIR /.." )
1818
19+ # Check if SSH agent is running
20+ if [ -z " $SSH_AUTH_SOCK " ]; then
21+ echo " SSH agent is not running. This script requires SSH agent to avoid multiple passphrase prompts."
22+ echo " Please run 'eval \$ (ssh-agent -s)' and 'ssh-add' before running this script."
23+ exit 1
24+ fi
25+
1926if [ -z " $RELEASE_VERSION " ]; then
2027 echo " Environment variable RELEASE_VERSION is not set. Please set it to run this script."
2128 exit 1
@@ -62,7 +69,7 @@ sed_inplace "tag: $OLD_VERSION" "tag: $RELEASE_VERSION" "$WORKSPACE_DIR"/helm/va
6269sed_inplace " deploy-$OLD_VERSION .yaml" " deploy-$RELEASE_VERSION .yaml" " $WORKSPACE_DIR " /docs/guides/deploy.md
6370sed_inplace " --version=$OLD_VERSION " " --version=$RELEASE_VERSION " " $WORKSPACE_DIR " /docs/guides/deploy.md
6471sed_inplace " --version=$OLD_VERSION " " --version=$RELEASE_VERSION " " $WORKSPACE_DIR " /docs/guides/getstarted.md
65- sed_inplace " mike deploy $OLD_VERSION " " mike deploy $RELEASE_VERSION " " $WORKSPACE_DIR " /.github/workflows/publish-doc.yml
72+ sed_inplace " mike deploy $OLD_VERSION " " mike deploy $RELEASE_VERSION " " $WORKSPACE_DIR " /.github/workflows/publish-doc.yaml
6673
6774
6875# Build the deploy.yaml
@@ -71,25 +78,45 @@ cp "deploy.yaml" "files/controller-installation/deploy-$RELEASE_VERSION.yaml"
7178
7279# only keep 4 recent versions deploy.yaml, removing the oldest one
7380VERSION_TO_REMOVE=$( git tag --sort=v:refname | grep -v ' rc' | tail -n 5 | head -n 1)
74- rm -f " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml"
81+ if [ -f " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml" ]; then
82+ echo " Removing old deploy file: deploy-$VERSION_TO_REMOVE .yaml"
83+ rm -f " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml"
84+ else
85+ echo " Old deploy file not found: deploy-$VERSION_TO_REMOVE .yaml. Skipping removal."
86+ fi
7587
76- # Crete a new release branch, tag and push the changes
88+ # Create a new release branch, tag and push the changes
7789git checkout -b release-$RELEASE_VERSION
90+
91+ # Add all modified files
7892git add " $WORKSPACE_DIR /README.md" \
7993 " $WORKSPACE_DIR /config/manager/kustomization.yaml" \
8094 " $WORKSPACE_DIR /helm/Chart.yaml" \
8195 " $WORKSPACE_DIR /helm/values.yaml" \
8296 " $WORKSPACE_DIR /files/controller-installation/deploy-$RELEASE_VERSION .yaml" \
83- " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml" \
84- " $WORKSPACE_DIR /docs/guides/deploy.md"
97+ " $WORKSPACE_DIR /docs/guides/deploy.md" \
98+ " $WORKSPACE_DIR /docs/guides/getstarted.md" \
99+
100+ # Add the old deploy file if it exists and was removed
101+ if [ -f " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml" ]; then
102+ git add " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml"
103+ fi
104+
85105git commit -m " Release artifacts for release $RELEASE_VERSION "
86106git push origin release-$RELEASE_VERSION
87- git tag -a $RELEASE_VERSION -m " Release artifacts for release $RELEASE_VERSION "
107+ git tag -a $RELEASE_VERSION -m " Release artifacts for release $RELEASE_VERSION "
88108git push origin $RELEASE_VERSION
89109
110+ # Check if GitHub CLI is authenticated and has necessary permissions
111+ if ! gh auth status & > /dev/null; then
112+ echo " GitHub CLI is not authenticated. Please run 'gh auth login' before running this script."
113+ exit 1
114+ fi
115+
90116# Create a PR
117+ echo " Creating a PR for release $RELEASE_VERSION ..."
91118gh pr create --title " Release artifacts for $RELEASE_VERSION " --body " Release artifacts for $RELEASE_VERSION " \
92119 --base aws:main --head aws:release-$RELEASE_VERSION \
93120 --repo aws/aws-application-networking-k8s --web
94121
95-
122+ echo " Release process completed successfully! "
0 commit comments