Skip to content

Commit 15c37f6

Browse files
committed
feat: split publish and deploy
1 parent b0be696 commit 15c37f6

File tree

4 files changed

+98
-18
lines changed

4 files changed

+98
-18
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,25 @@ jobs:
3535
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
3636
aws-region: us-east-1
3737

38-
- name: Build, Deploy and Publish layers
38+
- name: Build and Deploy layers
3939
if: steps.bun-version.outputs.latest != steps.bun-version.outputs.current
4040
run: |
41-
sam build
41+
sam build
4242
sam deploy \
4343
--stack-name bun-runtime \
4444
--no-confirm-changeset \
4545
--resolve-s3 \
46+
--no-execute-changeset ]
4647
--no-fail-on-empty-changeset \
4748
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND \
4849
--parameter-overrides "BunVersion=${{ steps.bun-version.outputs.latest }}"
4950
51+
- name: Publish layers
52+
if: steps.bun-version.outputs.latest != steps.bun-version.outputs.current
53+
run: |
54+
sam build --template-file publish.yml
5055
sam package \
51-
--output-template-file packaged.yaml \
56+
--output-template-file packaged.yml \
5257
--resolve-s3
5358
5459
sam publish \

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.aws-sam/*
22
*.zip
33
samconfig.toml
4+
packaged.yml
45
packaged.yaml

publish.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Transform: AWS::Serverless-2016-10-31
3+
Description: >
4+
Bun runtime packaged as a Lambda layer. This is bun itself not the lambda runtime layer bun also provides.
5+
6+
Parameters:
7+
BunVersion:
8+
Type: String
9+
Description: The version of Bun
10+
Default: 'latest'
11+
12+
Resources:
13+
BunLayerArm64:
14+
Type: AWS::Serverless::LayerVersion
15+
Properties:
16+
LayerName: BunRuntimeArm64
17+
Description: !Sub "Bun runtime v${BunVersion} (ARM64)"
18+
ContentUri: ./bun-layer-arm64.zip
19+
CompatibleArchitectures:
20+
- arm64
21+
CompatibleRuntimes:
22+
- provided
23+
LicenseInfo: https://github.com/sumcoding/bun-runtime/blob/main/LICENSE
24+
RetentionPolicy: Retain
25+
26+
BunLayerX64:
27+
Type: AWS::Serverless::LayerVersion
28+
Properties:
29+
LayerName: BunRuntimeX64
30+
Description: !Sub "Bun runtime v${BunVersion} (x64)"
31+
ContentUri: ./bun-layer-x64.zip
32+
CompatibleArchitectures:
33+
- x86_64
34+
CompatibleRuntimes:
35+
- provided
36+
LicenseInfo: https://github.com/sumcoding/bun-runtime/blob/main/LICENSE
37+
RetentionPolicy: Retain
38+
39+
Outputs:
40+
BunVersion:
41+
Description: The version of Bun
42+
Value: !Ref BunVersion
43+
Export:
44+
Name: BunVersion
45+
46+
BunLayerArm64:
47+
Description: Bun runtime (ARM64)
48+
Value: !Ref BunLayerArm64
49+
Export:
50+
Name: BunLayerArm64
51+
52+
BunLayerX64:
53+
Description: Bun runtime(x64)
54+
Value: !Ref BunLayerX64
55+
Export:
56+
Name: BunLayerX64
57+
58+
Metadata:
59+
AWS::ServerlessRepo::Application:
60+
Name: bun-runtime
61+
Description: >
62+
Bun runtime packaged as a Lambda layer.
63+
Bundles Bun runtime for ARM64 and x64 architectures.
64+
Author: Summer Phillips
65+
SpdxLicenseId: MIT
66+
LicenseUrl: LICENSE
67+
ReadmeUrl: README.md
68+
Labels: ['layer', 'bun', 'lambda', 'bun-runtime']
69+
HomePageUrl: https://github.com/sumcoding/bun-runtime
70+
SemanticVersion: !Ref BunVersion
71+
SourceCodeUrl: https://github.com/sumcoding/bun-runtime

template.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@ Resources:
3636
LicenseInfo: https://github.com/sumcoding/bun-runtime/blob/main/LICENSE
3737
RetentionPolicy: Retain
3838

39+
BunLayerX64VersionPermission:
40+
Type: AWS::Lambda::LayerVersionPermission
41+
DeletionPolicy: Retain
42+
UpdateReplacePolicy: Retain
43+
Properties:
44+
Action: lambda:GetLayerVersion
45+
LayerVersionArn: !Ref BunLayerX64
46+
Principal: '*'
47+
48+
BunLayerArm64VersionPermission:
49+
Type: AWS::Lambda::LayerVersionPermission
50+
DeletionPolicy: Retain
51+
UpdateReplacePolicy: Retain
52+
Properties:
53+
Action: lambda:GetLayerVersion
54+
LayerVersionArn: !Ref BunLayerArm64
55+
Principal: '*'
56+
3957
Outputs:
4058
BunVersion:
4159
Description: The version of Bun
@@ -54,18 +72,3 @@ Outputs:
5472
Value: !Ref BunLayerX64
5573
Export:
5674
Name: BunLayerX64
57-
58-
Metadata:
59-
AWS::ServerlessRepo::Application:
60-
Name: bun-runtime
61-
Description: >
62-
Bun runtime packaged as a Lambda layer.
63-
Bundles Bun runtime for ARM64 and x64 architectures.
64-
Author: Summer Phillips
65-
SpdxLicenseId: MIT
66-
LicenseUrl: LICENSE
67-
ReadmeUrl: README.md
68-
Labels: ['layer', 'bun', 'lambda', 'bun-runtime']
69-
HomePageUrl: https://github.com/sumcoding/bun-runtime
70-
SemanticVersion: !Ref BunVersion
71-
SourceCodeUrl: https://github.com/sumcoding/bun-runtime

0 commit comments

Comments
 (0)