Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: 'Release'
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g. 1.2.0 or v1.2.0)'
required: true
type: string

# Least-privilege by default; the publish job opts into id-token below.
permissions:
Expand Down Expand Up @@ -48,16 +54,22 @@ jobs:
- name: Ensure npm supports trusted publishing
# Trusted publishing requires npm >= 11.5.1.
run: npm install -g npm@latest
- name: Verify release tag matches package.json version
run: |
PKG_VERSION="v$(node -p "require('./package.json').version")"
TAG="${{ github.event.release.tag_name }}"
if [ "$PKG_VERSION" != "$TAG" ]; then
echo "::error::Release tag '$TAG' does not match package.json version '$PKG_VERSION'"
exit 1
fi
- name: Install dependencies
run: npm ci
- name: Set version to publish
# package.json ships a 0.0.0-development placeholder; the real version
# comes from the manual input (workflow_dispatch) or the release tag,
# with any leading "v" stripped (e.g. v1.2.0 -> 1.2.0).
run: |
VERSION="${INPUT_VERSION:-$TAG}"
if [ -z "$VERSION" ]; then
echo "::error::No version provided" && exit 1
fi
npm pkg set version="${VERSION#v}"
echo "Publishing version ${VERSION#v}"
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
TAG: ${{ github.event.release.tag_name }}
- name: Publish to npm
# No NODE_AUTH_TOKEN: auth happens via OIDC, provenance is automatic.
run: npm publish
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lambda-api",
"version": "1.2.0",
"version": "0.0.0-development",
"description": "Lightweight web framework for your serverless applications",
"main": "index.js",
"types": "index.d.ts",
Expand Down
Loading