Skip to content

workspace npmjs publish #5

workspace npmjs publish

workspace npmjs publish #5

#
# Copyright (C) 2026 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: workspace npmjs publish
on:
push:
tags:
- 'v*'
jobs:
publish:
name: Publish Workspace Configuration types to npmjs
runs-on: ubuntu-24.04
permissions:
id-token: write # Required for OIDC
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Determine version and npm tag
id: version_info
run: |
# Tag push: use tag version and publish to "latest"
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}" # Remove 'v' prefix
NPM_TAG="latest"
echo "Publishing tag version: $VERSION to npm tag: $NPM_TAG"
echo "version=$VERSION" >> ${GITHUB_OUTPUT}
echo "npm_tag=$NPM_TAG" >> ${GITHUB_OUTPUT}
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
name: Install pnpm
with:
run_install: false
package_json_file: workspace-configuration/typescript/package.json
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 24 # 24.x for npm publish with OIDC
cache: 'pnpm'
cache-dependency-path: workspace-configuration/typescript/pnpm-lock.yaml
- name: Execute pnpm
working-directory: ./workspace-configuration/typescript
run: pnpm install
- name: Generate schema
working-directory: ./workspace-configuration/typescript
run: pnpm run generate
- name: Publish to npmjs
working-directory: ./workspace-configuration/typescript
run: |
echo "Publishing version ${{ steps.version_info.outputs.version }} with npm tag: ${{ steps.version_info.outputs.npm_tag }}"
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.version_info.outputs.version }}\",#g" package.json
pnpm publish --provenance --tag ${{ steps.version_info.outputs.npm_tag }} --no-git-checks --access public