Skip to content

chore(deps): bump the react group with 3 updates (#6) #32

chore(deps): bump the react group with 3 updates (#6)

chore(deps): bump the react group with 3 updates (#6) #32

Workflow file for this run

# Copyright (c) 2025 IBM Corp.
# All rights reserved.
#
# 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.
name: contract-ui CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
dryRun:
description: 'Dry-Run'
default: 'true'
required: false
env:
DEFAULT_BRANCH: main
NODE_VERSION: '25.9.0'
jobs:
commit-lint:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Validate commit message
run: |
# Conventional commit regex pattern
# Valid types: feat, fix, docs, perf, revert, chore, refactor, test, build, ci
pattern='^(feat|fix|docs|perf|revert|chore|refactor|test|build|ci)(\([a-z0-9-]+\))?!?: .{1,}'
commit_sha="${{ github.event.pull_request.head.sha }}"
commit_message=$(git log --format=%B -n 1 $commit_sha | head -n 1)
short_sha=$(echo $commit_sha | cut -c1-7)
echo "Checking commit: $short_sha"
echo "Message: $commit_message"
echo ""
if ! echo "$commit_message" | grep -qE "$pattern"; then
echo "Invalid commit message format!"
echo ""
echo "Commit: $short_sha"
echo "Message: $commit_message"
echo ""
echo "Valid format: <type>(<optional-scope>): <description>"
echo ""
echo "Allowed types: feat, fix, docs, perf, revert, chore, refactor, test, build, ci"
echo ""
echo "Examples:"
echo " feat: add new feature"
echo " fix(ui): resolve rendering issue"
echo " docs: update README"
echo " chore!: breaking change in build process"
exit 1
fi
echo "Commit message is valid!"
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Cache Node modules
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build web assets
run: npm run build
- name: Verify build output
shell: bash
run: |
if [ ! -d "dist" ]; then
echo "Build failed: dist directory not found"
exit 1
fi
echo "Build successful: dist directory exists"
echo "Build artifacts:"
ls -lh dist/
- name: Check for build errors
shell: bash
run: |
if [ ! -f "dist/index.html" ]; then
echo "Error: index.html not found in dist directory"
exit 1
fi
echo "index.html found successfully"
release:
needs: [build]
if: github.repository == 'ibm-hyper-protect/contract-ui' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
issues: write
pull-requests: write
outputs:
new_release: ${{ steps.check_release.outputs.new_release }}
release_tag: ${{ steps.check_release.outputs.release_tag }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Get tags before release
id: before_release
run: |
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
- name: Cache Node modules
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
- name: Determine dry run mode
id: dry_run
run: |
dry_run=true
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.dryRun }}" != "true" ]]; then
dry_run=false
elif [[ "${{ github.ref }}" == "refs/heads/${{ env.DEFAULT_BRANCH }}" ]]; then
dry_run=false
elif [[ "${{ github.ref }}" =~ ^refs/heads/v[0-9]+(\.[0-9]+)?$ ]]; then
dry_run=false
fi
echo "dry_run=$dry_run" >> $GITHUB_OUTPUT
- name: Semantic Release
run: |
if [[ "${{ steps.dry_run.outputs.dry_run }}" == "true" ]]; then
npx -p @semantic-release/changelog \
-p @semantic-release/git \
-p @semantic-release/github \
-p @semantic-release/npm \
-p conventional-changelog-conventionalcommits \
-p semantic-release \
semantic-release --dry-run
else
npx -p @semantic-release/changelog \
-p @semantic-release/git \
-p @semantic-release/github \
-p @semantic-release/npm \
-p conventional-changelog-conventionalcommits \
-p semantic-release \
semantic-release
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if new release was created
id: check_release
if: steps.dry_run.outputs.dry_run == 'false'
run: |
git fetch --tags --force
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
before_tag="${{ steps.before_release.outputs.latest_tag }}"
if [[ "$latest_tag" != "$before_tag" && "$latest_tag" != "none" ]]; then
echo "New release detected: $latest_tag"
echo "new_release=true" >> $GITHUB_OUTPUT
echo "release_tag=$latest_tag" >> $GITHUB_OUTPUT
else
echo "No new release was created"
echo "new_release=false" >> $GITHUB_OUTPUT
fi
package:
needs: [release]
if: needs.release.outputs.new_release == 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: windows-latest
platform: windows
- os: macos-latest
platform: macos
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ needs.release.outputs.release_tag }}
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Cache Node modules
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build Electron app for Linux
if: matrix.platform == 'linux'
run: npm run package:linux
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Electron app for Windows
if: matrix.platform == 'windows'
run: npm run package:win
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Electron app for macOS
if: matrix.platform == 'macos'
run: npm run package:mac
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: List build artifacts
shell: bash
run: |
echo "Contents of dist-electron directory:"
ls -la dist-electron/ || echo "No dist-electron directory found"
- name: Upload Linux artifacts to release
if: matrix.platform == 'linux'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.release.outputs.release_tag }}
files: |
dist-electron/*.AppImage
dist-electron/*.deb
dist-electron/*.rpm
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Windows artifacts to release
if: matrix.platform == 'windows'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.release.outputs.release_tag }}
files: |
dist-electron/*.exe
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macOS artifacts to release
if: matrix.platform == 'macos'
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.release.outputs.release_tag }}
files: |
dist-electron/*.dmg
dist-electron/*.zip
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}