@@ -16,6 +16,13 @@ source ./scripts/lib/common.sh
16
16
SCRIPTS_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
17
17
WORKSPACE_DIR=$( realpath " $SCRIPTS_DIR /.." )
18
18
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
+
19
26
if [ -z " $RELEASE_VERSION " ]; then
20
27
echo " Environment variable RELEASE_VERSION is not set. Please set it to run this script."
21
28
exit 1
@@ -62,7 +69,7 @@ sed_inplace "tag: $OLD_VERSION" "tag: $RELEASE_VERSION" "$WORKSPACE_DIR"/helm/va
62
69
sed_inplace " deploy-$OLD_VERSION .yaml" " deploy-$RELEASE_VERSION .yaml" " $WORKSPACE_DIR " /docs/guides/deploy.md
63
70
sed_inplace " --version=$OLD_VERSION " " --version=$RELEASE_VERSION " " $WORKSPACE_DIR " /docs/guides/deploy.md
64
71
sed_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
66
73
67
74
68
75
# Build the deploy.yaml
@@ -71,25 +78,46 @@ cp "deploy.yaml" "files/controller-installation/deploy-$RELEASE_VERSION.yaml"
71
78
72
79
# only keep 4 recent versions deploy.yaml, removing the oldest one
73
80
VERSION_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
75
87
76
- # Crete a new release branch, tag and push the changes
88
+ # Create a new release branch, tag and push the changes
77
89
git checkout -b release-$RELEASE_VERSION
90
+
91
+ # Add all modified files
78
92
git add " $WORKSPACE_DIR /README.md" \
79
93
" $WORKSPACE_DIR /config/manager/kustomization.yaml" \
80
94
" $WORKSPACE_DIR /helm/Chart.yaml" \
81
95
" $WORKSPACE_DIR /helm/values.yaml" \
82
96
" $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
+ " $WORKSPACE_DIR /.github/workflows/publish-doc.yaml"
100
+
101
+ # Add the old deploy file if it exists and was removed
102
+ if [ -f " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml" ]; then
103
+ git add " $WORKSPACE_DIR /files/controller-installation/deploy-$VERSION_TO_REMOVE .yaml"
104
+ fi
105
+
85
106
git commit -m " Release artifacts for release $RELEASE_VERSION "
86
107
git push origin release-$RELEASE_VERSION
87
- git tag -a $RELEASE_VERSION -m " Release artifacts for release $RELEASE_VERSION "
108
+ git tag -a $RELEASE_VERSION -m " Release artifacts for release $RELEASE_VERSION "
88
109
git push origin $RELEASE_VERSION
89
110
111
+ # Check if GitHub CLI is authenticated and has necessary permissions
112
+ if ! gh auth status & > /dev/null; then
113
+ echo " GitHub CLI is not authenticated. Please run 'gh auth login' before running this script."
114
+ exit 1
115
+ fi
116
+
90
117
# Create a PR
118
+ echo " Creating a PR for release $RELEASE_VERSION ..."
91
119
gh pr create --title " Release artifacts for $RELEASE_VERSION " --body " Release artifacts for $RELEASE_VERSION " \
92
120
--base aws:main --head aws:release-$RELEASE_VERSION \
93
121
--repo aws/aws-application-networking-k8s --web
94
122
95
-
123
+ echo " Release process completed successfully! "
0 commit comments