-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (119 loc) · 4.24 KB
/
release.yml
File metadata and controls
138 lines (119 loc) · 4.24 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: release
on:
workflow_dispatch:
inputs:
version:
description: "Bun version for the release (e.g. 1.3.13)"
required: true
type: string
push:
branches:
- main
paths:
- ".bun-version"
jobs:
integration_test:
uses: ./.github/workflows/integration.yml
secrets: inherit
release:
needs: integration_test
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Resolve bun version
id: bun
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION=$(cat .bun-version)
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Bun version: ${VERSION}"
- name: Compute package version
id: pkg
run: |
BUN_VERSION="${{ steps.bun.outputs.version }}"
BUN_MAJOR=$(echo "$BUN_VERSION" | cut -d. -f1)
BUN_MINOR=$(echo "$BUN_VERSION" | cut -d. -f2)
BUN_PATCH=$(echo "$BUN_VERSION" | cut -d. -f3)
# Package version: 2.<bun_major*100+bun_minor>.<bun_patch>
PKG_MINOR=$((BUN_MAJOR * 100 + BUN_MINOR))
PKG_VERSION="2.${PKG_MINOR}.${BUN_PATCH}"
echo "version=${PKG_VERSION}" >> "$GITHUB_OUTPUT"
echo "Package version: ${PKG_VERSION} (from Bun v${BUN_VERSION})"
- name: Check if version already released
id: check
run: |
TAG="v${{ steps.pkg.outputs.version }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "::warning::Tag ${TAG} already exists. Skipping release."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Setup Bun
if: steps.check.outputs.skip == 'false'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
if: steps.check.outputs.skip == 'false'
run: bun install --frozen-lockfile
- name: Setup Node.js
if: steps.check.outputs.skip == 'false'
uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- name: Build
if: steps.check.outputs.skip == 'false'
run: |
bun command/buildLayer.ts
bunx projen build
env:
BUN_VERSION: ${{ steps.bun.outputs.version }}
- name: Set package version and package
if: steps.check.outputs.skip == 'false'
run: |
node -e "
const pkg = require('./package.json');
pkg.version = '${{ steps.pkg.outputs.version }}';
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
bunx projen package:js
- name: Verify layer zip exists
if: steps.check.outputs.skip == 'false'
run: |
ZIP_FILE="lib/bun-lambda-layer-${{ steps.bun.outputs.version }}.zip"
if [ ! -f "$ZIP_FILE" ]; then
echo "::error::Layer zip not found: ${ZIP_FILE}"
exit 1
fi
- name: Create GitHub Release
if: steps.check.outputs.skip == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ steps.pkg.outputs.version }}"
name: "v${{ steps.pkg.outputs.version }}"
body: |
## Lambda Bun Runtime v${{ steps.pkg.outputs.version }}
Built with Bun v${{ steps.bun.outputs.version }}
### Versioning
Package version `2.X.Y` maps to Bun version where `X = bun_major*100 + bun_minor` and `Y = bun_patch`.
### Assets
- `bun-lambda-layer-${{ steps.bun.outputs.version }}.zip` — Prebuilt Lambda layer (Linux ARM64)
files: "lib/bun-lambda-layer-${{ steps.bun.outputs.version }}.zip"
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
if: steps.check.outputs.skip == 'false'
run: npm publish dist/js/*.tgz --provenance --access public