|
16 | 16 | publish: |
17 | 17 | name: Publish |
18 | 18 | runs-on: ubuntu-latest |
19 | | - timeout-minutes: 10 |
| 19 | + timeout-minutes: 20 |
20 | 20 | environment: npm-publish |
21 | 21 | permissions: |
22 | 22 | contents: write |
@@ -120,8 +120,59 @@ jobs: |
120 | 120 | - run: corepack prepare [email protected] --activate |
121 | 121 | - run: bun install --frozen-lockfile |
122 | 122 | - run: bun run build |
| 123 | + |
| 124 | + # Before `npm publish`, so @hyperframes/aws-lambda pins this exact zip. |
| 125 | + - name: Build Lambda handler zip |
| 126 | + id: lambda_zip |
| 127 | + env: |
| 128 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 129 | + VERSION: ${{ steps.version.outputs.version }} |
| 130 | + REPO: ${{ github.repository }} |
| 131 | + run: | |
| 132 | + # A retried run reuses the zip already on the release, so the pin still matches it. |
| 133 | + if gh release download "v${VERSION}" --repo "$REPO" --pattern hyperframes-lambda-handler.zip --dir dist; then |
| 134 | + echo "attached=true" >> "$GITHUB_OUTPUT" |
| 135 | + else |
| 136 | + bun run --cwd packages/aws-lambda build:zip |
| 137 | + fi |
| 138 | + bun packages/aws-lambda/scripts/pin-handler-zip.ts |
| 139 | +
|
123 | 140 | - run: bun run verify:packed-manifests |
124 | 141 |
|
| 142 | + - name: Create GitHub Release |
| 143 | + env: |
| 144 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 145 | + VERSION: ${{ steps.version.outputs.version }} |
| 146 | + PRERELEASE: ${{ steps.version.outputs.prerelease }} |
| 147 | + REPO: ${{ github.repository }} |
| 148 | + run: | |
| 149 | + NOTES_FILE="releases/v${VERSION}.md" |
| 150 | +
|
| 151 | + # Skip if release already exists (idempotent re-runs) |
| 152 | + if gh release view "v${VERSION}" --repo "$REPO" >/dev/null 2>&1; then |
| 153 | + echo "Release v${VERSION} already exists — skipping" |
| 154 | + else |
| 155 | + FLAGS=(--repo "$REPO" --title "v${VERSION}") |
| 156 | + if [ -f "$NOTES_FILE" ]; then |
| 157 | + FLAGS+=(--notes-file "$NOTES_FILE") |
| 158 | + else |
| 159 | + echo "No reviewed release notes found at $NOTES_FILE — using GitHub generated notes" |
| 160 | + FLAGS+=(--generate-notes) |
| 161 | + fi |
| 162 | + if [ "$PRERELEASE" = "true" ]; then |
| 163 | + FLAGS+=(--prerelease) |
| 164 | + fi |
| 165 | + gh release create "v${VERSION}" "${FLAGS[@]}" |
| 166 | + fi |
| 167 | +
|
| 168 | + - name: Attach Lambda handler zip to release |
| 169 | + if: steps.lambda_zip.outputs.attached != 'true' |
| 170 | + env: |
| 171 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 172 | + VERSION: ${{ steps.version.outputs.version }} |
| 173 | + REPO: ${{ github.repository }} |
| 174 | + run: gh release upload "v${VERSION}" dist/hyperframes-lambda-handler.zip dist/hyperframes-lambda-handler.sha256 --repo "$REPO" |
| 175 | + |
125 | 176 | - name: Publish packages |
126 | 177 | env: |
127 | 178 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
@@ -190,32 +241,6 @@ jobs: |
190 | 241 | exit 1 |
191 | 242 | fi |
192 | 243 |
|
193 | | - - name: Create GitHub Release |
194 | | - env: |
195 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
196 | | - VERSION: ${{ steps.version.outputs.version }} |
197 | | - PRERELEASE: ${{ steps.version.outputs.prerelease }} |
198 | | - REPO: ${{ github.repository }} |
199 | | - run: | |
200 | | - NOTES_FILE="releases/v${VERSION}.md" |
201 | | -
|
202 | | - # Skip if release already exists (idempotent re-runs) |
203 | | - if gh release view "v${VERSION}" --repo "$REPO" >/dev/null 2>&1; then |
204 | | - echo "Release v${VERSION} already exists — skipping" |
205 | | - else |
206 | | - FLAGS=(--repo "$REPO" --title "v${VERSION}") |
207 | | - if [ -f "$NOTES_FILE" ]; then |
208 | | - FLAGS+=(--notes-file "$NOTES_FILE") |
209 | | - else |
210 | | - echo "No reviewed release notes found at $NOTES_FILE — using GitHub generated notes" |
211 | | - FLAGS+=(--generate-notes) |
212 | | - fi |
213 | | - if [ "$PRERELEASE" = "true" ]; then |
214 | | - FLAGS+=(--prerelease) |
215 | | - fi |
216 | | - gh release create "v${VERSION}" "${FLAGS[@]}" |
217 | | - fi |
218 | | -
|
219 | 244 | - name: Build portable agent plugin |
220 | 245 | run: node scripts/package-agent-plugin.mjs |
221 | 246 |
|
|
0 commit comments