Skip to content

feat: Add otp generation routes (#11) #25

feat: Add otp generation routes (#11)

feat: Add otp generation routes (#11) #25

Workflow file for this run

name: Release
on:
push:
tags:
- "core-v*"
- "express-v*"
jobs:
publish:
name: Publish Package
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Determine package and version
id: meta
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ "$TAG" == core-v* ]]; then
PACKAGE="core"
VERSION="${TAG#core-v}"
elif [[ "$TAG" == express-v* ]]; then
PACKAGE="express"
VERSION="${TAG#express-v}"
else
echo "Invalid tag format"
exit 1
fi
echo "package=$PACKAGE" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing $PACKAGE version $VERSION"
- name: Validate package.json version matches tag
working-directory: packages/${{ steps.meta.outputs.package }}
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if [ "$PACKAGE_VERSION" != "${{ steps.meta.outputs.version }}" ]; then
echo "Version mismatch!"
echo "Tag version: ${{ steps.meta.outputs.version }}"
echo "package.json version: $PACKAGE_VERSION"
exit 1
fi
- name: Install dependencies
working-directory: packages/${{ steps.meta.outputs.package }}
run: npm ci
- name: Build
working-directory: packages/${{ steps.meta.outputs.package }}
run: npm run build
- name: Publish to npm
working-directory: packages/${{ steps.meta.outputs.package }}
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}