/ .github / workflows / ui-release.yml
ui-release.yml
  1  name: "Release UI"
  2  
  3  on:
  4    workflow_call:
  5      inputs:
  6        tag:
  7          description: "UI tag to release (e.g., ui-v1.0.0)"
  8          required: true
  9          type: string
 10  
 11  permissions:
 12    contents: write
 13    packages: write
 14    id-token: write
 15  
 16  jobs:
 17    validate-tag:
 18      name: "Validate UI Tag"
 19      runs-on: ubuntu-latest
 20      outputs:
 21        tag: ${{ steps.get-tag.outputs.tag }}
 22        version: ${{ steps.get-version.outputs.version }}
 23      steps:
 24        - name: Get tag from input or ref
 25          id: get-tag
 26          run: |
 27            TAG="${{ inputs.tag }}"
 28  
 29            # Validate tag format (ui-v*)
 30            if [[ ! "$TAG" =~ ^ui-v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
 31              echo "Error: Tag '$TAG' does not match the expected format 'ui-v*.*.*'"
 32              exit 1
 33            fi
 34  
 35            echo "tag=$TAG" >> $GITHUB_OUTPUT
 36            echo "Using tag: $TAG"
 37  
 38        - name: Extract version from tag
 39          id: get-version
 40          run: |
 41            TAG="${{ steps.get-tag.outputs.tag }}"
 42            # Remove 'ui-v' prefix to get version
 43            VERSION="${TAG#ui-v}"
 44            echo "version=$VERSION" >> $GITHUB_OUTPUT
 45            echo "Version: $VERSION"
 46  
 47    publish-ui:
 48      name: "Build and Publish UI Package"
 49      runs-on: ubuntu-latest
 50      needs: validate-tag
 51      defaults:
 52        run:
 53          working-directory: client/webui/frontend
 54      steps:
 55        - name: Checkout code
 56          uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
 57          with:
 58            ref: ${{ needs.validate-tag.outputs.tag }}
 59  
 60        - name: Setup Node.js
 61          uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
 62          with:
 63            node-version: "25.5.0"
 64            cache: "npm"
 65            cache-dependency-path: client/webui/frontend/package-lock.json
 66            registry-url: https://npm.pkg.github.com/
 67            scope: "@SolaceLabs"
 68  
 69        - name: Configure npm for install and publish
 70          run: |
 71            echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
 72            echo "@SolaceLabs:registry=https://npm.pkg.github.com/" >> .npmrc
 73            echo "legacy-peer-deps=true" >> .npmrc
 74  
 75        - name: Install dependencies
 76          run: npm ci
 77          env:
 78            NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 79  
 80        - name: Verify package version matches tag
 81          run: |
 82            PACKAGE_VERSION=$(node -p "require('./package.json').version")
 83            TAG_VERSION="${{ needs.validate-tag.outputs.version }}"
 84  
 85            if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
 86              echo "Error: Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
 87              exit 1
 88            fi
 89  
 90            echo "✅ Package version matches tag version: $PACKAGE_VERSION"
 91  
 92        - name: Build UI package
 93          run: npm run build-package
 94  
 95        - name: Update package.json for publishing
 96          run: |
 97            node -e "
 98            const pkg = require('./package.json');
 99            pkg.name = '@SolaceLabs/solace-agent-mesh-ui';
100            pkg.publishConfig = {
101              registry: 'https://npm.pkg.github.com/SolaceLabs'
102            };
103            require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
104            "
105  
106        - name: Publish to GitHub Packages
107          run: npm publish
108          env:
109            NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}