Skip to content

fix: pin keycloak-admin-client package version to 26.5.6 (#77) #38

fix: pin keycloak-admin-client package version to 26.5.6 (#77)

fix: pin keycloak-admin-client package version to 26.5.6 (#77) #38

Workflow file for this run

name: Publish package to NPM
on:
push:
branches:
- main
paths:
- "package.json"
workflow_dispatch:
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.version-check.outputs.should_publish }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Check if version changed
id: version-check
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
PUBLISHED_VERSION=$(npm view @red-hat-developer-hub/e2e-test-utils version 2>/dev/null || echo "0.0.0")
echo "Current version: $CURRENT_VERSION"
echo "Published version: $PUBLISHED_VERSION"
if [ "$CURRENT_VERSION" = "$PUBLISHED_VERSION" ]; then
echo "should_publish=false" >> "$GITHUB_OUTPUT"
echo "Version $CURRENT_VERSION is already published. Skipping."
else
echo "should_publish=true" >> "$GITHUB_OUTPUT"
echo "New version $CURRENT_VERSION will be published."
fi
publish:
name: Publish to NPM
needs: check-version
if: needs.check-version.outputs.should_publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: "22"
- name: Enable Corepack
run: corepack enable
- name: Install Dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Configure npm registry
run: yarn config set npmPublishRegistry "https://registry.npmjs.org"
- name: Publish
run: yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.RHDH_NPM_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.RHDH_NPM_TOKEN }}