Skip to content

Bump tool versions #289

Bump tool versions

Bump tool versions #289

name: Bump tool versions
on:
workflow_dispatch:
inputs:
product-name:
description: Name of the product to set version for
required: true
type: choice
options:
- specmatic-jms
- specmatic-core
- specmatic-grpc
- specmatic-jdbc
- specmatic-async
- specmatic-redis
- specmatic-arazzo
- specmatic-studio
- specmatic-graphql
- specmatic-openapi
- specmatic-google-pubsub
- specmatic-release-test
- specmatic-enterprise
product-version:
description: Product version to set for the specified product
required: true
type: string
concurrency:
group: bump-version
cancel-in-progress: false
jobs:
bump_version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout documentation repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: main
token: "${{ secrets.SPECMATIC_GITHUB_TOKEN }}"
- name: Configure git cli
run: |
git config --global user.email "github-service-account@specmatic.io"
git config --global user.name "Specmatic GitHub Service Account"
- name: Validate version format
env:
PRODUCT_NAME: ${{ github.event.inputs.product-name }}
PRODUCT_VERSION: ${{ github.event.inputs.product-version }}
run: |
if [[ -z "${PRODUCT_NAME}" ]] || [[ -z "${PRODUCT_VERSION}" ]]; then
echo "ERROR: Product name or version is empty" >&2
exit 1
fi
if [[ ! "${PRODUCT_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
echo "ERROR: Invalid version format. Expected: X.Y.Z or X.Y.Z-suffix"
exit 1
fi
- name: Bump versions.ts and commit
env:
PRODUCT_NAME: ${{ github.event.inputs.product-name }}
PRODUCT_VERSION: ${{ github.event.inputs.product-version }}
run: |
set -euo pipefail
FILE="src/constants/specmatic-versions.json"
echo "Bumping ${PRODUCT_NAME} version to ${PRODUCT_VERSION} in ${FILE}"
node scripts/bump-version.js "$PRODUCT_NAME" "$PRODUCT_VERSION"
git add "$FILE"
if ! git diff --cached --quiet; then
git commit -m "Updated ${PRODUCT_NAME} version to ${PRODUCT_VERSION}"
git push
echo "Updated ${PRODUCT_NAME} version to ${PRODUCT_VERSION}"
else
echo "No changes to commit, version is already up to date."
fi