Skip to content

Commit

Permalink
Merge pull request #40 from TophrC-dd/SVLS-4661
Browse files Browse the repository at this point in the history
SVLS-4661 -- Create a script that will update the AAS-Wrapper documentation when a new version is released
  • Loading branch information
jcstorms1 authored Jun 28, 2024
2 parents b991658 + a31f18d commit 16faa0d
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions scripts/update_documentation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-2024 Datadog, Inc.

# This script automatically opens a PR to the Documentation repo for Datadog-AAS-Wrapper

GREEN="\033[0;32m"
NC="\033[0;0m"
DOCUMENTATION_REPO_PATH=$HOME/go/src/github.com/DataDog/documentation
DOCUMENTATION_FILE=./content/en/serverless/azure_app_services/azure_app_services_linux.md

function print_color {
printf "$GREEN$1$NC\n"
}

print_color "Creating a Github PR to update documentation"

if [ ! -d $DOCUMENTATION_REPO_PATH ]; then
print_color "Documentation directory does not exist, cloning into $DOCUMENTATION_REPO_PATH"
git clone [email protected]:Datadog/documentation $DOCUMENTATION_REPO_PATH
fi

cd $DOCUMENTATION_REPO_PATH

# Make sure they don't have any local changes
if [ ! -z "$(git status --porcelain)" ]; then
print_color "Documentation directory is dirty -- please stash or save your changes and manually create the PR"
exit 1
fi

print_color "Pulling latest changes from Github"
git checkout master
git pull

print_color "Checking out new branch that has version changes"
git checkout -b $USER/bump-aas-wrapper-version-$VERSION
sed -i '' -e '/.*datadog-aas-linux/{' -e 's/v[0-9]*.[0-9]*.[0-9]*/'"$VERSION"'/' -e '}' $DOCUMENTATION_FILE
git add $DOCUMENTATION_FILE

print_color "Creating commit -- please tap your Yubikey if prompted"
git commit -m "Bump AAS-WRAPPER to version $VERSION"
git push --set-upstream origin $USER/bump-aas-wrapper-version-$VERSION
dd-pr

# Reset documentation repo to clean a state that's tracking master
print_color "Resetting documentation git branch to master"
git checkout -B master origin/master

0 comments on commit 16faa0d

Please sign in to comment.