pfy version
pfy version reads and changes the version: field in project.yaml. Use it to show the current version, set an exact value, or bump major/minor/patch (with optional pre-release labels).
Synopsis
pfy version <subcommand> [flags]Description
The version command group provides tools for managing your project's semantic version stored in project.yaml. Supports showing, setting, and incrementing versions according to semver 2.0.0.
TIP
pfy version manages the project version. To print the CLI binary's own version, use the global pfy --version flag; it reports the version stamped into the binary at build time, not anything from project.yaml.
Subcommands
pfy version show
Display the current project version.
pfy version showOutput:
1.2.3Use Cases:
- Check current version before release
- Use in scripts:
VERSION=$(pfy version show) - Verify version after bump
pfy version set
Set the project version to a specific value.
pfy version set --version <version>Flags:
--version(required): the new version string
set does not validate the value. Whatever you pass is written to project.yaml; a malformed value is only rejected by the next version bump. See Error Handling.
Examples:
# Set to specific version
pfy version set --version 2.0.0
# Output:
# Version updated: 1.2.3 → 2.0.0
# Configuration saved to project.yamlUse Cases:
- Align with external version numbers
- Reset version after major refactor
- Match version to git tag
pfy version bump
Increment the project version using semantic versioning rules.
pfy version bump --part <major|minor|patch>Flags:
--part: Version component to increment (default:patch)major: Breaking changes (1.2.3 → 2.0.0)minor: New features (1.2.3 → 1.3.0)patch: Bug fixes (1.2.3 → 1.2.4)
--pre: Pre-release label to attach or advance (e.g.,--part minor --pre rcgives 1.2.3 → 1.3.0-rc.1). Omit it to cut a normal release.
Examples:
# Increment patch version (default)
pfy version bump
# or explicitly:
pfy version bump --part patch
# 1.2.3 → 1.2.4
# Increment minor version
pfy version bump --part minor
# 1.2.3 → 1.3.0
# Increment major version
pfy version bump --part major
# 1.2.3 → 2.0.0
# Cut a release candidate
pfy version bump --part minor --pre rc
# 1.2.3 → 1.3.0-rc.1
# Reapplying the same label advances the counter
pfy version bump --part minor --pre rc
# 1.3.0-rc.1 → 1.3.0-rc.2
# Drop --pre to release the candidate
pfy version bump --part patch
# 1.3.0-rc.1 → 1.3.0Behavior:
patchincrements the third number and keeps major and minorminorincrements the second number and resets patch to 0majorincrements the first number and resets minor and patch to 0- Bumping without
--prestrips any pre-release or build metadata. A bump that would merely release an existing pre-release does exactly that rather than skipping ahead:1.3.0-rc.1with--part patchbecomes1.3.0, not1.3.1, since semver orders1.3.0-rc.1 < 1.3.0. - Reapplying the same
--prelabel advances its counter (rc.1→rc.2) instead of restarting it or jumping to the next release.
Examples
Development Workflow
# Check current version
pfy version show
# 1.0.0
# Make bug fix
# ... code changes ...
pfy version bump --part patch
# 1.0.0 → 1.0.1
# Add new feature
# ... code changes ...
pfy version bump --part minor
# 1.0.1 → 1.1.0
# Breaking change
# ... code changes ...
pfy version bump --part major
# 1.1.0 → 2.0.0Release Script
#!/bin/bash
# release.sh
# Bump version
pfy version bump --part minor
# Get new version
VERSION=$(pfy version show)
# Tag and push
git tag "v$VERSION"
git push --tags
echo "Released version $VERSION"CI/CD Integration
Used automatically in CI/CD pipelines (see Auto-Versioning):
# GitHub Actions
- name: Bump version
run: |
pfy version bump --part patch
echo "NEW_VERSION=$(pfy version show)" >> $GITHUB_ENVGlobal Flags
All global pfy flags are available:
--verbose, -v: Show detailed output--quiet, -q: Suppress non-essential output
Verbose Output
pfy --verbose version bump --part minorOutput:
Incrementing minor version from 1.2.3...
Version updated: 1.2.3 → 1.3.0
Configuration saved to project.yamlQuiet Output
pfy --quiet version bump --part patchNo output (check exit code for success).
Version Format
Versions must follow Semantic Versioning 2.0.0:
Format: major.minor.patch
Where:
major: Breaking changes, incompatible API changesminor: New features, backwards compatiblepatch: Bug fixes, backwards compatible
Valid Examples:
0.1.0 # Initial development
1.0.0 # First stable release
1.2.3 # Version with all components
1.3.0-rc.1 # Pre-release
10.5.128 # Large version numbersInvalid Examples:
1.2 # Missing patch
v1.2.3 # No 'v' prefixError Handling
Invalid Version Format
version set accepts any string, so the error surfaces on the next bump:
$ pfy version set --version 1.2
Version updated: 1.2.3 → 1.2
Configuration saved to project.yaml
$ pfy version bump
Error: failed to increment version: invalid version format: 1.2 (expected format: x.y.z[-prerelease][+build])Solution: set a three-part version (1.2.0) and bump again.
No project.yaml
If project.yaml does not exist, the CLI falls back to a default configuration, so pfy version show prints the default version:
$ pfy version show
0.1.0To manage a real project version, initialize the project first:
pfy init --name my-projectInvalid Bump Part
$ pfy version bump --part release
Error: invalid version part: release (expected: major, minor, or patch)Solution: Use major, minor, or patch
Integration
With CI/CD Templates
For Node.js projects, pfy ci update bakes the project version into the generated build job:
# Set version
pfy version set --version 1.5.0
# Generate CI templates
pfy ci update
# The Node.js pipeline builds my-app:1.5.0 and, on main, bumps and pushes
# my-app:1.5.1 plus my-app:latestGo pipelines do not use the project version; see ci.
With Application Update-Version/Copy
The project version feeds the application-version commands:
# Push the current project version to the Manager
pfy application update-version \
--app my-app \
--project my-saas \
--version $(pfy version show)
# `application copy` without --version also defaults to the
# project.yaml version (then the source application's version)
pfy application copy \
--project my-saas \
--from-app my-app \
--to-tenant customer-a \
--slug my-app-copyIn Scripts
#!/bin/bash
# Get current version
CURRENT=$(pfy version show)
echo "Current version: $CURRENT"
# Bump version
pfy version bump --part patch
NEW=$(pfy version show)
echo "Updated to: $NEW"
# Use in Docker build
docker build -t my-app:$NEW .Configuration
Version is stored in project.yaml:
project_name: my-app
version: 1.2.3 # ← Managed by version command
ci:
type: github
language: goBest Practices
1. Commit After Version Changes
Always commit version changes:
pfy version bump --part minor
git add project.yaml
git commit -m "Bump version to $(pfy version show)"2. Match Git Tags
Keep git tags synchronized:
VERSION=$(pfy version show)
git tag "v$VERSION"
git push --tags3. Automate in CI
Let CI handle patch bumps automatically (the generated Node.js pipeline already does; for Go add a step like this):
# .github/workflows/ci.yml
on:
push:
branches: [main]
jobs:
version-and-deploy:
steps:
- name: Auto-bump patch version
run: pfy version bump --part patch4. Manual Bumps for Features/Breaking Changes
Reserve minor/major bumps for developers:
# Before starting new feature
pfy version bump --part minor
# Before breaking change
pfy version bump --part majorSee Also
- Version Management Guide - Project and application versions
- Auto-Versioning - CI/CD version automation
- Project Configuration - project.yaml reference
- pfy init - Initialize project
- pfy ci - CI/CD templates