Skip to content

[GitHub Actions] Generate NodeJS SDK v3.183.0 from OAS repo #422

[GitHub Actions] Generate NodeJS SDK v3.183.0 from OAS repo

[GitHub Actions] Generate NodeJS SDK v3.183.0 from OAS repo #422

name: "Publish to npm 🚀"
on:
push:
branches:
- main
paths:
- package.json
permissions:
id-token: write # Required for OIDC
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: |
npm install -g npm@latest
yarn install --frozen-lockfile
- name: Build
run: npm run build
- name: Publish v2 to npm
run: npm publish --access public
- name: Extract version from package.json
id: package-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create GitHub Release
run: |
if gh release view "v${{ steps.package-version.outputs.version }}" &> /dev/null; then
echo "Release v${{ steps.package-version.outputs.version }} already exists"
else
gh release create "v${{ steps.package-version.outputs.version }}" \
--title "v${{ steps.package-version.outputs.version }}" \
--generate-notes
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}