From 98b8398e7762539e6f4871e455d207a1280ed571 Mon Sep 17 00:00:00 2001 From: Leandro Echevarria Date: Mon, 25 Aug 2025 15:23:22 -0300 Subject: [PATCH 1/4] feat | LAY-917 Fix listing versions --- .github/workflows/publish-to-aws.yaml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-to-aws.yaml b/.github/workflows/publish-to-aws.yaml index ce28d28..165ecfe 100644 --- a/.github/workflows/publish-to-aws.yaml +++ b/.github/workflows/publish-to-aws.yaml @@ -60,23 +60,33 @@ jobs: id: list_versions run: | # Get existing versions from S3 (ignore errors if bucket is empty) - aws s3 ls s3://${{ secrets.S3_BUCKET_NAME }}/versions/ || true > existing_versions.txt + aws s3 ls s3://${{ secrets.S3_BUCKET_NAME }}/versions/ 2>/dev/null > existing_versions.txt || echo "" > existing_versions.txt + + # Extract version numbers from S3 listing + EXISTING_VERSIONS="" + if [ -s existing_versions.txt ]; then + EXISTING_VERSIONS=$(awk '{print $2}' existing_versions.txt | sed 's/\///g' | grep -v '^$' | sort -V) + fi - # Extract version numbers and add current version - VERSIONS=$(awk '{print $2}' existing_versions.txt | sed 's/\///g' | sort -V) CURRENT_VERSION="${{ steps.get_version.outputs.VERSION }}" + echo "Current version: $CURRENT_VERSION" + echo "Existing versions from S3: $EXISTING_VERSIONS" # Combine existing and current versions, remove duplicates, and sort - ALL_VERSIONS=$(echo -e "$VERSIONS\n$CURRENT_VERSION" | sort -V | uniq) + if [ -z "$EXISTING_VERSIONS" ]; then + ALL_VERSIONS="$CURRENT_VERSION" + else + ALL_VERSIONS=$(echo -e "$EXISTING_VERSIONS\n$CURRENT_VERSION" | sort -V | uniq | grep -v '^$') + fi echo "Available versions:" echo "$ALL_VERSIONS" - # Save for use in HTML generation - echo "$ALL_VERSIONS" > all_versions.txt + # Save for use in HTML generation (ensure no empty lines) + echo "$ALL_VERSIONS" | grep -v '^$' > all_versions.txt - # Format for JSON array (for potential future use) - VERSIONS_JSON=$(echo "$ALL_VERSIONS" | jq -R . | jq -s .) + # Format for JSON array (for potential future use) - filter out empty strings + VERSIONS_JSON=$(echo "$ALL_VERSIONS" | grep -v '^$' | jq -R . | jq -s .) echo "VERSIONS_JSON=$VERSIONS_JSON" >> $GITHUB_OUTPUT - name: Copy package files to simple index (all versions) From 75a3564a47b12b202e084af71e84c3ee02e051c0 Mon Sep 17 00:00:00 2001 From: Leandro Echevarria Date: Mon, 25 Aug 2025 15:26:58 -0300 Subject: [PATCH 2/4] feat | LAY-917 Fix get_version script path --- .github/workflows/publish-to-aws.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-to-aws.yaml b/.github/workflows/publish-to-aws.yaml index 165ecfe..8990a5b 100644 --- a/.github/workflows/publish-to-aws.yaml +++ b/.github/workflows/publish-to-aws.yaml @@ -65,28 +65,42 @@ jobs: # Extract version numbers from S3 listing EXISTING_VERSIONS="" if [ -s existing_versions.txt ]; then - EXISTING_VERSIONS=$(awk '{print $2}' existing_versions.txt | sed 's/\///g' | grep -v '^$' | sort -V) + EXISTING_VERSIONS=$(awk '{print $2}' existing_versions.txt | sed 's/\///g' | grep -v '^$' | sort -V || true) fi CURRENT_VERSION="${{ steps.get_version.outputs.VERSION }}" echo "Current version: $CURRENT_VERSION" echo "Existing versions from S3: $EXISTING_VERSIONS" + # Validate current version is not empty + if [ -z "$CURRENT_VERSION" ]; then + echo "Error: Current version is empty" + exit 1 + fi + # Combine existing and current versions, remove duplicates, and sort if [ -z "$EXISTING_VERSIONS" ]; then ALL_VERSIONS="$CURRENT_VERSION" else - ALL_VERSIONS=$(echo -e "$EXISTING_VERSIONS\n$CURRENT_VERSION" | sort -V | uniq | grep -v '^$') + ALL_VERSIONS=$(echo -e "$EXISTING_VERSIONS\n$CURRENT_VERSION" | sort -V | uniq | grep -v '^$' || echo "$CURRENT_VERSION") fi echo "Available versions:" echo "$ALL_VERSIONS" # Save for use in HTML generation (ensure no empty lines) - echo "$ALL_VERSIONS" | grep -v '^$' > all_versions.txt + if [ -n "$ALL_VERSIONS" ]; then + echo "$ALL_VERSIONS" | grep -v '^$' > all_versions.txt || echo "$ALL_VERSIONS" > all_versions.txt + else + echo "$CURRENT_VERSION" > all_versions.txt + fi # Format for JSON array (for potential future use) - filter out empty strings - VERSIONS_JSON=$(echo "$ALL_VERSIONS" | grep -v '^$' | jq -R . | jq -s .) + if [ -n "$ALL_VERSIONS" ]; then + VERSIONS_JSON=$(echo "$ALL_VERSIONS" | grep -v '^$' | jq -R . | jq -s . || echo "[]") + else + VERSIONS_JSON='[]' + fi echo "VERSIONS_JSON=$VERSIONS_JSON" >> $GITHUB_OUTPUT - name: Copy package files to simple index (all versions) From beb99bc66603dec041a02d732374654c33754026 Mon Sep 17 00:00:00 2001 From: Leandro Echevarria Date: Mon, 25 Aug 2025 15:29:48 -0300 Subject: [PATCH 3/4] feat | LAY-917 Fixing version --- .github/workflows/publish-to-aws.yaml | 37 +++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-aws.yaml b/.github/workflows/publish-to-aws.yaml index 8990a5b..9febfc1 100644 --- a/.github/workflows/publish-to-aws.yaml +++ b/.github/workflows/publish-to-aws.yaml @@ -35,8 +35,41 @@ jobs: - name: Get package version id: get_version run: | - chmod +x ./scripts/get_version.sh - VERSION=$(./scripts/get_version.sh) + echo "Current working directory:" + pwd + echo "Listing files:" + ls -la + + echo "Checking if version file exists..." + if [ -f "src/atlas/_version.py" ]; then + echo "Version file found:" + cat src/atlas/_version.py + + # Extract version directly + VERSION=$(grep -E '^__version__\s*=' src/atlas/_version.py | grep -o '".*"' | tr -d '"') + echo "Direct extraction result: '$VERSION'" + else + echo "Version file not found, trying script method..." + fi + + # Fallback to script method if direct extraction failed + if [ -z "$VERSION" ]; then + echo "Trying script method..." + chmod +x ./scripts/get_version.sh + ls -la ./scripts/get_version.sh + VERSION=$(./scripts/get_version.sh 2>&1) + echo "Script output: '$VERSION'" + + # Extract just the version (last line) in case there's debug output + VERSION=$(echo "$VERSION" | tail -n 1) + fi + + if [ -z "$VERSION" ]; then + echo "Error: Could not extract version" + exit 1 + fi + + echo "Final version: '$VERSION'" echo "VERSION=$VERSION" >> $GITHUB_OUTPUT echo "Package version: $VERSION" From 27d3bc68cd54c46129d9e5deeb704469c65048f3 Mon Sep 17 00:00:00 2001 From: Leandro Echevarria Date: Mon, 25 Aug 2025 15:32:52 -0300 Subject: [PATCH 4/4] feat | LAY-917 Fixing the listing of the versions folder --- .github/workflows/publish-to-aws.yaml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-to-aws.yaml b/.github/workflows/publish-to-aws.yaml index 9febfc1..d763226 100644 --- a/.github/workflows/publish-to-aws.yaml +++ b/.github/workflows/publish-to-aws.yaml @@ -128,13 +128,23 @@ jobs: echo "$CURRENT_VERSION" > all_versions.txt fi - # Format for JSON array (for potential future use) - filter out empty strings - if [ -n "$ALL_VERSIONS" ]; then - VERSIONS_JSON=$(echo "$ALL_VERSIONS" | grep -v '^$' | jq -R . | jq -s . || echo "[]") - else - VERSIONS_JSON='[]' - fi + # Format for JSON array (for potential future use) - simplified approach + VERSIONS_JSON="[" + FIRST=true + while IFS= read -r version; do + if [ -n "$version" ]; then + if [ "$FIRST" = true ]; then + VERSIONS_JSON="$VERSIONS_JSON\"$version\"" + FIRST=false + else + VERSIONS_JSON="$VERSIONS_JSON,\"$version\"" + fi + fi + done < all_versions.txt + VERSIONS_JSON="$VERSIONS_JSON]" + echo "VERSIONS_JSON=$VERSIONS_JSON" >> $GITHUB_OUTPUT + echo "Generated JSON: $VERSIONS_JSON" - name: Copy package files to simple index (all versions) run: |