-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (87 loc) · 3.37 KB
/
build-layer.yml
File metadata and controls
104 lines (87 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: build-layer
on:
workflow_dispatch:
inputs:
version:
description: "Bun version to build (semver, e.g. 1.3.13)"
required: true
type: string
workflow_call:
inputs:
version:
description: "Bun version to build (semver, e.g. 1.3.13)"
required: true
type: string
jobs:
build-and-pr:
name: Build layer and create PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
BUN_VERSION: ${{ inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Remove old layer zip
run: rm -f lib/bun-lambda-layer-*.zip
- name: Build layer
run: bun command/buildLayer.ts
- name: Verify layer zip exists
run: |
ZIP_FILE="lib/bun-lambda-layer-${{ inputs.version }}.zip"
if [ ! -f "$ZIP_FILE" ]; then
echo "::error::Layer zip not found: ${ZIP_FILE}"
exit 1
fi
echo "Layer zip built: ${ZIP_FILE}"
- name: Update .bun-version
run: echo "${{ inputs.version }}" > .bun-version
- name: Update src/index.ts
run: |
sed -i "s/const bunVersion = \".*\"/const bunVersion = \"${{ inputs.version }}\"/" src/index.ts
- name: Update README.md
run: |
sed -i "s|Current bun version: \[.*\](.*)|Current bun version: [${{ inputs.version }}](https://bun.sh/blog/bun-v${{ inputs.version }})|" README.md
- name: Build CDK constructs
run: bunx projen compile
- name: Set git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Compute package version
id: pkg
run: |
BUN_MAJOR=$(echo "${{ inputs.version }}" | cut -d. -f1)
BUN_MINOR=$(echo "${{ inputs.version }}" | cut -d. -f2)
BUN_PATCH=$(echo "${{ inputs.version }}" | cut -d. -f3)
PKG_MINOR=$((BUN_MAJOR * 100 + BUN_MINOR))
echo "version=2.${PKG_MINOR}.${BUN_PATCH}" >> "$GITHUB_OUTPUT"
- name: Commit and create PR
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "feat: update bun runtime to v${{ inputs.version }}"
branch: "bun-update/${{ inputs.version }}"
title: "feat: update bun runtime to v${{ inputs.version }}"
body: |
Updates the Bun Lambda runtime layer to v${{ inputs.version }}.
**Package version:** `${{ steps.pkg.outputs.version }}`
### Changes
- Built new layer zip: `lib/bun-lambda-layer-${{ inputs.version }}.zip`
- Updated `src/index.ts` version constant
- Updated `README.md` version badge
- Updated `.bun-version`
Merging this PR will trigger the release workflow and publish `@beesolve/lambda-bun-runtime@${{ steps.pkg.outputs.version }}` to npm.
[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
add-paths: |
.bun-version
src/index.ts
README.md