Skip to content

NPM Release

NPM Release #14

Workflow file for this run

name: NPM Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Versión exacta (ej. 0.5.3)"
required: true
default: "0.5.3"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
defaults:
run:
working-directory: molsysviewer/js
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag || github.ref_name }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install latest npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Inject version and repo info
id: get_version
run: |
CLEAN_VERSION=$(echo "${{ github.event.inputs.tag || github.ref_name }}" | sed 's/^v//')
npm version $CLEAN_VERSION --no-git-tag-version
npm pkg set repository.type="git"
npm pkg set repository.url="https://github.com/uibcdf/molsysviewer"
npm pkg set repository.directory="molsysviewer/js"
echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUT
- name: Build runtime bundle
run: npm run build
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.version }}
- name: Publish to npm
run: |
rm -f .npmrc ~/.npmrc
npm publish --access public --provenance