Skip to content

Commit f8a506c

Browse files
committed
feat: update ci for better release, update docs
1 parent 92ce97f commit f8a506c

File tree

5 files changed

+66
-26
lines changed

5 files changed

+66
-26
lines changed

.github/workflows/check-bun-version.yml

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ permissions:
1010
id-token: write
1111

1212
jobs:
13-
check-and-update:
13+
check:
1414
runs-on: ubuntu-latest
15+
outputs:
16+
latest: ${{ steps.bun-version.outputs.latest }}
17+
current: ${{ steps.bun-version.outputs.current }}
1518
steps:
1619
- uses: actions/checkout@v4
1720

@@ -23,20 +26,24 @@ jobs:
2326
echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT
2427
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
2528
29+
update:
30+
runs-on: ubuntu-latest
31+
needs: check
32+
if: needs.check.outputs.latest != needs.check.outputs.current
33+
steps:
34+
- uses: actions/checkout@v4
35+
2636
- name: Build layers if version changed
27-
if: steps.bun-version.outputs.latest != steps.bun-version.outputs.current
2837
run: |
29-
BUN_VERSION="${{ steps.bun-version.outputs.latest }}" ./bootstrap
38+
BUN_VERSION="${{ needs.check.outputs.latest }}" ./bootstrap
3039
3140
- name: Configure AWS credentials
32-
if: steps.bun-version.outputs.latest != steps.bun-version.outputs.current
3341
uses: aws-actions/configure-aws-credentials@v4
3442
with:
3543
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
3644
aws-region: us-east-1
3745

3846
- name: Build and Deploy layers
39-
if: steps.bun-version.outputs.latest != steps.bun-version.outputs.current
4047
run: |
4148
sam build
4249
sam deploy \
@@ -46,10 +53,9 @@ jobs:
4653
--no-execute-changeset ]
4754
--no-fail-on-empty-changeset \
4855
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND \
49-
--parameter-overrides "BunVersion=${{ steps.bun-version.outputs.latest }}"
56+
--parameter-overrides "BunVersion=${{ needs.check.outputs.latest }}"
5057
5158
- name: Publish layers
52-
if: steps.bun-version.outputs.latest != steps.bun-version.outputs.current
5359
run: |
5460
sam build --template-file publish.yml
5561
sam package \
@@ -58,29 +64,42 @@ jobs:
5864
5965
sam publish \
6066
--template-file packaged.yaml \
61-
--semantic-version ${{ steps.bun-version.outputs.latest }}
67+
--semantic-version ${{ needs.check.outputs.latest}}
6268
6369
- name: Update version file
64-
if: success() && steps.bun-version.outputs.latest != steps.bun-version.outputs.current
6570
run: |
66-
echo "${{ steps.bun-version.outputs.latest }}" > .bun-version
71+
echo "${{ needs.check.outputs.latest }}" > .bun-version
6772
git config --global user.name 'github-actions[bot]'
6873
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
6974
git add .bun-version
70-
git commit -m "chore: update bun version to ${{ steps.bun-version.outputs.latest }}"
75+
git commit -m "chore: update bun version to ${{ needs.check.outputs.latest }}"
7176
git push
7277
78+
- name: Arn Version
79+
id: arn-version
80+
run: |
81+
STACK_OUTPUTS=$(sam list stack-outputs --stack-name bun-runtime --output json)
82+
83+
ARM64_LAYER_ARN=$(echo "$STACK_OUTPUTS" | jq -r '.[] | select(.OutputKey=="BunLayerArm64") | .OutputValue')
84+
X64_LAYER_ARN=$(echo "$STACK_OUTPUTS" | jq -r '.[] | select(.OutputKey=="BunLayerX64") | .OutputValue')
85+
86+
ARM64_LAYER_VERSION=$(echo $ARM64_LAYER_ARN | awk -F: '{print $NF}')
87+
X64_LAYER_VERSION=$(echo $X64_LAYER_ARN | awk -F: '{print $NF}')
88+
89+
echo "arm64_layer_version=$ARM64_LAYER_VERSION" >> $GITHUB_OUTPUT
90+
echo "x64_layer_version=$X64_LAYER_VERSION" >> $GITHUB_OUTPUT
91+
7392
- name: Create GitHub Release
74-
if: success() && steps.bun-version.outputs.latest != steps.bun-version.outputs.current
7593
uses: softprops/action-gh-release@v1
7694
with:
77-
tag_name: v${{ steps.bun-version.outputs.latest }}
78-
name: Bun runtime layer with v${{ steps.bun-version.outputs.latest }}
95+
tag_name: v${{ needs.check.outputs.latest }}
96+
name: Bun runtime layer with v${{ needs.check.outputs.latest }}
7997
body: |
80-
This release updates the Bun runtime to version ${{ steps.bun-version.outputs.latest }}.
98+
This release updates the Bun runtime to version ${{ needs.check.outputs.latest }}.
8199
82100
### Changes
83-
- Updated Bun to version ${{ steps.bun-version.outputs.latest }}
84-
- AWS Lambda layers published for x64 and arm64 architectures
101+
- Updated Bun to version ${{ needs.check.outputs.latest }}
102+
- Updated AWS Lambda layer for ARM64 (version ${{ steps.arn-version.outputs.arm64_layer_version }})
103+
- Updated AWS Lambda layer for x64 (version ${{ steps.arn-version.outputs.x64_layer_version }})
85104
draft: false
86105
prerelease: false

PUBLISH.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Bun Runtime for AWS Lambda
2+
3+
This repository provides [Bun](https://bun.sh/) as an AWS Lambda runtime layer.
4+
5+
> Note:
6+
> This is Bun itself packaged as a Lambda layer, not the special Lambda runtime layer that Bun provides. If you need that layer, you can find instructions over at [oven-sh/bun/packages/bun-lambda](https://github.com/oven-sh/bun/tree/main/packages/bun-lambda)
7+
8+
## Available Layers
9+
10+
Two architecture layers are included:
11+
12+
#### BunRuntimeArm64
13+
`arn:aws:lambda:{region}:{account}:layer:BunRuntimeArm64:1`
14+
15+
#### BunRuntimeX64
16+
`arn:aws:lambda:{region}:{account}:layer:BunRuntimeX64:1`
17+
18+
## License
19+
20+
MIT
21+
22+
## Author
23+
@sumcoding

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ This repository provides [Bun](https://bun.sh/) as an AWS Lambda runtime layer.
88
## Available Layers
99

1010
Two architecture layers are available:
11-
12-
#### BunRuntimeArm64
13-
`arn:aws:lambda:us-east-1:582637575117:layer:BunRuntimeArm64:1`
14-
15-
#### BunRuntimeX64
16-
`arn:aws:lambda:us-east-1:582637575117:layer:BunRuntimeX64:1`
11+
| Layer Name | Arch | ARN |
12+
|-----------------|-------|-----------------------------------------------------------------|
13+
| BunRuntimeArm64 | ARM64 | `arn:aws:lambda:us-east-1:582637575117:layer:BunRuntimeArm64:{version}` |
14+
| BunRuntimeX64 | X64 | `arn:aws:lambda:us-east-1:582637575117:layer:BunRuntimeX64:{version}` |
1715

1816
## Automatic Updates
1917

publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AWSTemplateFormatVersion: 2010-09-09
22
Transform: AWS::Serverless-2016-10-31
33
Description: >
4-
Bun runtime packaged as a Lambda layer. This is bun itself not the lambda runtime layer bun also provides.
4+
Bun runtime packaged as a Lambda layer.
55
66
Parameters:
77
BunVersion:
@@ -64,7 +64,7 @@ Metadata:
6464
Author: Summer Phillips
6565
SpdxLicenseId: MIT
6666
LicenseUrl: LICENSE
67-
ReadmeUrl: README.md
67+
ReadmeUrl: PUBLISH.md
6868
Labels: ['layer', 'bun', 'lambda', 'bun-runtime']
6969
HomePageUrl: https://github.com/sumcoding/bun-runtime
7070
SemanticVersion: !Ref BunVersion

template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AWSTemplateFormatVersion: 2010-09-09
22
Transform: AWS::Serverless-2016-10-31
33
Description: >
4-
Bun runtime packaged as a Lambda layer. This is bun itself not the lambda runtime layer bun also provides.
4+
Bun runtime packaged as a Lambda layer.
55
66
Parameters:
77
BunVersion:

0 commit comments

Comments
 (0)