Skip to content

Commit 62ecf25

Browse files
feat: polish readme, resolve codex comment, version downgrade for next build cycle
1 parent ae07bec commit 62ecf25

3 files changed

Lines changed: 43 additions & 4 deletions

File tree

.github/workflows/update_readme.yaml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,56 @@ jobs:
2727
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2828
aws-region: us-east-1
2929

30-
- name: Get Latest Release URL and Tag Version
30+
- name: Check if update needed
31+
id: check_update
3132
run: |
3233
JSON_RESPONSE=$(curl -s https://api.github.com/repos/Sparticuz/chromium/releases/latest)
3334
TAG_VERSION=$(echo $JSON_RESPONSE | grep -Po '"tag_name": "\K[^"]+')
35+
CURRENT_VERSION=$(cat .tag_version || echo '')
36+
37+
# Get layer file sizes for both architectures and convert to MB
38+
X64_SIZE_BYTES=$(echo $JSON_RESPONSE | grep -Po '"name": "chromium-[^"]+-layer\.x64\.zip"[^}]*"size": \K[0-9]+' | head -1)
39+
ARM64_SIZE_BYTES=$(echo $JSON_RESPONSE | grep -Po '"name": "chromium-[^"]+-layer\.arm64\.zip"[^}]*"size": \K[0-9]+' | head -1)
40+
41+
if [[ -n "$X64_SIZE_BYTES" ]]; then
42+
X64_SIZE_MB=$((X64_SIZE_BYTES / 1024 / 1024))
43+
echo "X64_SIZE_MB=$X64_SIZE_MB" >> $GITHUB_ENV
44+
else
45+
echo "X64_SIZE_MB=63" >> $GITHUB_ENV
46+
fi
47+
48+
if [[ -n "$ARM64_SIZE_BYTES" ]]; then
49+
ARM64_SIZE_MB=$((ARM64_SIZE_BYTES / 1024 / 1024))
50+
echo "ARM64_SIZE_MB=$ARM64_SIZE_MB" >> $GITHUB_ENV
51+
else
52+
echo "ARM64_SIZE_MB=62" >> $GITHUB_ENV
53+
fi
54+
55+
if [[ "$TAG_VERSION" == "$CURRENT_VERSION" ]]; then
56+
echo "No new version to update. Current: $CURRENT_VERSION, Latest: $TAG_VERSION"
57+
echo "skip=true" >> $GITHUB_OUTPUT
58+
exit 0
59+
fi
60+
61+
echo "New version detected: $TAG_VERSION (current: $CURRENT_VERSION)"
62+
echo "skip=false" >> $GITHUB_OUTPUT
3463
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
3564
65+
- name: Get Latest Release URL and Tag Version
66+
if: steps.check_update.outputs.skip == 'false'
67+
run: |
68+
echo "TAG_VERSION=${{ env.TAG_VERSION }}" >> $GITHUB_ENV
69+
3670
- name: Update README
71+
if: steps.check_update.outputs.skip == 'false'
3772
run: |
3873
TAG_VERSION=${{ env.TAG_VERSION }}
74+
X64_SIZE_MB=${{ env.X64_SIZE_MB }}
75+
ARM64_SIZE_MB=${{ env.ARM64_SIZE_MB }}
3976
ARN_BASE="arn:aws:lambda:"
4077
ACCOUNT_ID="764866452798"
4178
79+
sed -i -e "s|> .*compressed with Brotli|> ${X64_SIZE_MB} MB (x64) / ${ARM64_SIZE_MB} MB (arm64) Chromium layer for AWS Lambda compressed with Brotli|g" readme.md
4280
sed -i -e "s|Has Chromium v[0-9\.]*|Has Chromium $TAG_VERSION|g" readme.md
4381
4482
for REGION in ${{ env.AWS_REGIONS }}; do
@@ -53,6 +91,7 @@ jobs:
5391
done
5492
5593
- name: Commit and Push
94+
if: steps.check_update.outputs.skip == 'false'
5695
run: |
5796
git config --local user.email "action@github.com"
5897
git config --local user.name "GitHub Action"

.tag_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v143.0.0
1+
v141.0.0

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Google Chrome for AWS Lambda as a layer
22

3-
> 58 MB Google Chrome to fit inside AWS Lambda Layer compressed with Brotli
3+
> 66 MB (x64) / 64 MB (arm64) Chromium layer for AWS Lambda compressed with Brotli
44
55
[Sparticuz/chromium](https://github.com/Sparticuz/chromium) published as a Lambda Layer.
66

7-
Tested with Node.js 16x/18x/20x. Compatible with x86_64 and arm64 architectures. Has Chromium v143.0.0
7+
Tested with Node.js 16x/18x/20x/22x. Compatible with x86_64 and arm64 architectures. Has Chromium v141.0.0
88

99
## Getting Started
1010

0 commit comments

Comments
 (0)