Auto update AWS LibAwsIO package #6528
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto update AWS LibAwsIO package | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Run every hour | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| LIBAWS_REPO: "JuliaServices/LibAwsIO.jl" | |
| JLL_REPO: "JuliaBinaryWrappers/aws_c_io_jll.jl" | |
| LIBAWS_PATH: "libaws" # Path for LibAwsX.jl repo | |
| JLL_PATH: "jll" # Path for aws_c_X_jll.jl repo | |
| LIBRARY_NAME: "aws_c_io" | |
| JLL_NAME: "aws_c_io_jll" | |
| jobs: | |
| update-awsio-package: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout LibAwsIO repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.LIBAWS_REPO }} | |
| ref: main | |
| path: ${{ env.LIBAWS_PATH }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout BinaryWrapper repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.JLL_REPO }} | |
| ref: main | |
| path: ${{ env.JLL_PATH }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Parse current JLL version | |
| id: parse_jll_version | |
| run: | | |
| RAW_JLL_VERSION=$(grep -oP -m 1 '(?<=version = ")[^"]+' ${{ env.JLL_PATH }}/Project.toml) | |
| JLL_VERSION=$(echo "$RAW_JLL_VERSION" | sed 's/+[0-9]*//') | |
| echo "jll_version=${JLL_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Parse Project.toml compat version | |
| id: parse_project_version | |
| run: | | |
| COMPAT_SECTION=$(awk '/^\[compat\]/ {flag=1; next} /^\[/{flag=0} flag' ${{ env.LIBAWS_PATH }}/Project.toml) | |
| PROJECT_VERSION=$(echo "$COMPAT_SECTION" | grep -oP "(?<=${{ env.JLL_NAME }} = \")[^\"]+" | sed 's/^=//') | |
| echo "project_version=${PROJECT_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Check for version updates | |
| id: check_version | |
| run: | | |
| if [[ "${{ steps.parse_jll_version.outputs.jll_version }}" != "${{ steps.parse_project_version.outputs.project_version }}" ]]; then | |
| echo "New version found: ${{ steps.parse_jll_version.outputs.jll_version }} (was ${{ steps.parse_project_version.outputs.project_version }})" | |
| echo "update_needed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "No update needed." | |
| echo "update_needed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Skip update | |
| if: steps.check_version.outputs.update_needed != 'true' | |
| run: echo "Versions already match; skipping generator run." | |
| - name: Update Project.toml Versions | |
| if: steps.check_version.outputs.update_needed == 'true' | |
| run: | | |
| sed -i "s/${{ env.JLL_NAME }} = \"=${{ steps.parse_project_version.outputs.project_version }}\"/${{ env.JLL_NAME }} = \"=${{ steps.parse_jll_version.outputs.jll_version }}\"/" ${{ env.LIBAWS_PATH }}/Project.toml | |
| sed -i "s/${{ env.JLL_NAME }} = \"=${{ steps.parse_project_version.outputs.project_version }}\"/${{ env.JLL_NAME }} = \"=${{ steps.parse_jll_version.outputs.jll_version }}\"/" ${{ env.LIBAWS_PATH }}/gen/Project.toml | |
| CURRENT_LIBAWS_VERSION=$(grep -oP -m 1 '(?<=version = ")[^"]+' ${{ env.LIBAWS_PATH }}/Project.toml) | |
| PATCH=$(echo $CURRENT_LIBAWS_VERSION | awk -F. '{print $3+1}') | |
| NEW_LIBAWS_VERSION=$(echo $CURRENT_LIBAWS_VERSION | awk -F. '{print $1"."$2"."'"$PATCH"'}') | |
| sed -i "s/version = \"$CURRENT_LIBAWS_VERSION\"/version = \"$NEW_LIBAWS_VERSION\"/" ${{ env.LIBAWS_PATH }}/Project.toml | |
| - name: Inspect disk usage before cleanup | |
| if: steps.check_version.outputs.update_needed == 'true' | |
| run: | | |
| echo "Disk usage before cleanup:" | |
| df -h | |
| echo "Preinstalled SDK sizes (if present):" | |
| sudo du -sh /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL 2>/dev/null || true | |
| - name: Free disk space for generator | |
| if: steps.check_version.outputs.update_needed == 'true' | |
| run: | | |
| set -euxo pipefail | |
| sudo rm -rf /usr/share/dotnet || true | |
| sudo rm -rf /usr/local/lib/android || true | |
| sudo rm -rf /opt/ghc || true | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL || true | |
| sudo rm -rf /tmp/* || true | |
| sudo docker system prune --all --volumes --force || true | |
| sudo apt-get clean | |
| sudo rm -rf /var/lib/apt/lists/* | |
| echo "Disk usage after cleanup:" | |
| df -h | |
| - uses: julia-actions/cache@v2 | |
| if: steps.check_version.outputs.update_needed == 'true' | |
| - name: Run the generator | |
| if: steps.check_version.outputs.update_needed == 'true' | |
| run: | | |
| cd ${{ env.LIBAWS_PATH }} | |
| ./gen/generate.sh | |
| - name: Check for Changes in Bindings | |
| if: steps.check_version.outputs.update_needed == 'true' | |
| id: check_bindings | |
| run: | | |
| cd ${{ env.LIBAWS_PATH }} | |
| if git diff --quiet; then | |
| echo "No bindings changes detected." | |
| echo "bindings_changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Bindings changed." | |
| echo "bindings_changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and Open PR | |
| if: steps.check_bindings.outputs.bindings_changed == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| path: ${{ env.LIBAWS_PATH }} | |
| branch: update-${{ env.JLL_NAME }}-${{ steps.parse_jll_version.outputs.jll_version }} | |
| commit-message: "Update ${{ env.JLL_NAME }} to version ${{ steps.parse_jll_version.outputs.jll_version }}" | |
| title: "Update ${{ env.JLL_NAME }} to version ${{ steps.parse_jll_version.outputs.jll_version }}" | |
| body: | | |
| This PR updates the JLL dependency and regenerates bindings automatically. | |
| - Updated **${{ env.JLL_NAME }}** to version **${{ steps.parse_jll_version.outputs.jll_version }}** | |
| - Updated **${{ env.LIBAWS_REPO }}** version number | |
| - **Bindings regeneration:** | |
| - ${{ steps.check_bindings.outputs.bindings_changed == 'true' && '✅ Updated bindings' || '⚠️ No bindings changes detected' }} | |
| reviewers: quinnj, Octogonapus | |
| token: ${{ secrets.ORG_PAT }} |