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

update: fetch latest release tag #2911

Merged
merged 2 commits into from
Sep 30, 2024
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
18 changes: 12 additions & 6 deletions shared-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,19 @@ function _verifyAmplifyBackendCompatability {

# 3. Validate Shell (Emulating the "validate" shell)
echo "Emulating Validate Shell"
# Move back to root and clone amplify-backend repo
cd ..
git clone --depth 1 https:/aws-amplify/amplify-backend.git
cd amplify-backend
# Create a new local branch for testing
git checkout -B validate-amplify-backend
# Update the packages and ensure the correct versions are being used
REPO_URL="https:/aws-amplify/amplify-backend.git"
REPO_DIR="amplify-backend"
# Fetch the latest release tag
echo "Fetching the latest release tag from GitHub"
LATEST_RELEASE_JSON=$(curl -s https://api.github.com/repos/aws-amplify/amplify-backend/releases/latest)
# Extract the tag name
LATEST_RELEASE_TAG=$(echo "${LATEST_RELEASE_JSON}" | jq -r '.tag_name')
Copy link
Member

Choose a reason for hiding this comment

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

Are we guaranteed to have jq installed in the CodeBuild image?

echo "Latest release tag: ${LATEST_RELEASE_TAG}"
# Clone the repository at the specific tag
echo "Cloning the repository at tag ${LATEST_RELEASE_TAG}"
git clone --depth 1 --branch "${LATEST_RELEASE_TAG}" "${REPO_URL}" "${REPO_DIR}"
cd "${REPO_DIR}" || { echo "Failed to enter directory ${REPO_DIR}"; exit 1; }
npm update
# Verify that the package-lock.json contains the updated version with localhost tarballs
git diff package-lock.json | grep -Pz '@aws-amplify\/(graphql-api-construct|data-construct)[\s\S]*localhost:4873[\s\S]*tgz'
Expand Down
Loading