Skip to content

Commit 5667b90

Browse files
committed
update generate bindigns
1 parent 11fc68a commit 5667b90

File tree

1 file changed

+102
-40
lines changed

1 file changed

+102
-40
lines changed
Lines changed: 102 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,113 @@
1-
name: Generate Bindings
1+
name: Auto update AWS LibAwsS3 package
2+
23
on:
4+
schedule:
5+
- cron: '0 * * * *' # Run every hour
36
workflow_dispatch:
4-
push:
5-
branches: [main]
6-
paths:
7-
- .github/workflows/generate_bindings.yml
8-
- gen/**
9-
pull_request:
10-
branches: [main]
11-
paths:
12-
- .github/workflows/generate_bindings.yml
13-
- gen/**
14-
concurrency:
15-
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
16-
cancel-in-progress: true
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
env:
13+
LIBAWS_REPO: "JuliaServices/LibAwsS3.jl"
14+
JLL_REPO: "JuliaBinaryWrappers/aws_c_s3_jll.jl"
15+
LIBAWS_PATH: "libaws" # Path for LibAwsX.jl repo
16+
JLL_PATH: "jll" # Path for aws_c_X_jll.jl repo
17+
LIBRARY_NAME: "aws_c_s3"
18+
JLL_NAME: "aws_c_s3_jll"
19+
1720
jobs:
18-
generate-bindings:
19-
name: Generate bindings
20-
runs-on: ubuntu-22.04
21-
timeout-minutes: 20
21+
update-awss3-package:
22+
runs-on: ubuntu-latest
23+
2224
steps:
23-
- uses: actions/checkout@v4
25+
- name: Checkout LibAwsS3 repository
26+
uses: actions/checkout@v4
27+
with:
28+
repository: ${{ env.LIBAWS_REPO }}
29+
ref: main
30+
path: ${{ env.LIBAWS_PATH }}
31+
token: ${{ secrets.GITHUB_TOKEN }}
2432

25-
- uses: julia-actions/setup-julia@v1
33+
- name: Checkout BinaryWrapper repository
34+
uses: actions/checkout@v4
2635
with:
27-
version: "1.10.2"
36+
repository: ${{ env.JLL_REPO }}
37+
ref: main
38+
path: ${{ env.JLL_PATH }}
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Parse current JLL version
42+
run: |
43+
RAW_JLL_VERSION=$(grep -oP -m 1 '(?<=version = ")[^"]+' ${{ env.JLL_PATH }}/Project.toml)
44+
JLL_VERSION=$(echo "$RAW_JLL_VERSION" | sed 's/+[0-9]*//')
45+
echo "JLL_VERSION=${JLL_VERSION}" >> $GITHUB_ENV
46+
47+
- name: Parse Project.toml compat version
48+
run: |
49+
COMPAT_SECTION=$(awk '/^\[compat\]/ {flag=1; next} /^\[/{flag=0} flag' ${{ env.LIBAWS_PATH }}/Project.toml)
50+
PROJECT_VERSION=$(echo "$COMPAT_SECTION" | grep -oP "(?<=${{ env.JLL_NAME }} = \")[^\"]+" | sed 's/^=//')
51+
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_ENV
52+
53+
- name: Check for version updates
54+
id: check_version
55+
run: |
56+
if [[ "$JLL_VERSION" != "$PROJECT_VERSION" ]]; then
57+
echo "New version found: $JLL_VERSION (was $PROJECT_VERSION)"
58+
echo "update_needed=true" >> $GITHUB_ENV
59+
else
60+
echo "No update needed."
61+
exit 0
62+
fi
63+
64+
- name: Update Project.toml Versions
65+
if: env.update_needed == 'true'
66+
run: |
67+
sed -i "s/${{ env.JLL_NAME }} = \"=$PROJECT_VERSION\"/${{ env.JLL_NAME }} = \"=$JLL_VERSION\"/" ${{ env.LIBAWS_PATH }}/Project.toml
68+
sed -i "s/${{ env.JLL_NAME }} = \"=$PROJECT_VERSION\"/${{ env.JLL_NAME }} = \"=$JLL_VERSION\"/" ${{ env.LIBAWS_PATH }}/gen/Project.toml
69+
70+
CURRENT_LIBAWS_VERSION=$(grep -oP -m 1 '(?<=version = ")[^"]+' ${{ env.LIBAWS_PATH }}/Project.toml)
71+
PATCH=$(echo $CURRENT_LIBAWS_VERSION | awk -F. '{print $3+1}')
72+
NEW_LIBAWS_VERSION=$(echo $CURRENT_LIBAWS_VERSION | awk -F. '{print $1"."$2"."'"$PATCH"'}')
73+
sed -i "s/version = \"$CURRENT_LIBAWS_VERSION\"/version = \"$NEW_LIBAWS_VERSION\"/" ${{ env.LIBAWS_PATH }}/Project.toml
74+
75+
- uses: julia-actions/cache@v2
2876

2977
- name: Run the generator
30-
run: ./gen/generate.sh
78+
if: env.update_needed == 'true'
79+
run: |
80+
cd ${{ env.LIBAWS_PATH }}
81+
./gen/generate.sh
3182
32-
- name: Create Pull Request (on push)
33-
if: ${{ github.event_name == 'push' }}
34-
uses: peter-evans/create-pull-request@v6
35-
with:
36-
commit-message: "Regenerate bindings"
37-
title: "Regenerate bindings"
38-
reviewers: |
39-
quinnj
40-
Octogonapus
41-
42-
- name: Create Pull Request (on PR)
43-
if: ${{ github.event_name == 'pull_request' }}
83+
- name: Check for Changes in Bindings
84+
if: env.update_needed == 'true'
85+
id: check_bindings
86+
run: |
87+
cd ${{ env.LIBAWS_PATH }}
88+
if git diff --quiet; then
89+
echo "No bindings changes detected."
90+
echo "bindings_changed=false" >> $GITHUB_ENV
91+
else
92+
echo "Bindings changed."
93+
echo "bindings_changed=true" >> $GITHUB_ENV
94+
fi
95+
96+
- name: Commit and Open PR
97+
if: env.bindings_changed == 'true'
4498
uses: peter-evans/create-pull-request@v6
4599
with:
46-
base: ${{ github.head_ref }}
47-
commit-message: "Regenerate bindings"
48-
title: "Regenerate bindings"
49-
reviewers: |
50-
quinnj
51-
Octogonapus
100+
path: ${{ env.LIBAWS_PATH }}
101+
branch: update-${{ env.JLL_NAME }}-${{ env.JLL_VERSION }}
102+
commit-message: "Update ${{ env.JLL_NAME }} to version ${{ env.JLL_VERSION }}"
103+
title: "Update ${{ env.JLL_NAME }} to version ${{ env.JLL_VERSION }}"
104+
body: |
105+
This PR updates the JLL dependency and regenerates bindings automatically.
106+
107+
- Updated **${{ env.JLL_NAME }}** to version **${{ env.JLL_VERSION }}**
108+
- Updated **${{ env.LIBAWS_REPO }}** version number
109+
- **Bindings regeneration:**
110+
- ${{ env.bindings_changed == 'true' && '✅ Updated bindings' || '⚠️ No bindings changes detected' }}
111+
112+
reviewers: quinnj, Octogonapus
113+
token: ${{ secrets.ORG_PAT }}

0 commit comments

Comments
 (0)