Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 69 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pipeline {
agent { label 'agent'}
parameters {
booleanParam(name: 'PUBLISH', defaultValue: false, description: 'Trigger publish stage')
}
environment {
NPM_AUTH_TOKEN = credentials('Appcircle-CLI-NPM-Cred')
GITHUB_PAT = credentials('ozer-github-pat')
Expand Down Expand Up @@ -228,9 +225,77 @@ pipeline {
}
}

stage('Auto Publish Alpha') {
when {
allOf {
anyOf {
branch 'develop'
branch pattern: 'pipeline/test-.*', comparator: 'REGEXP'
branch pattern: 'fixes/.*', comparator: 'REGEXP'
changeRequest()
}
not { changelog '.*\\[skip ci\\].*' }
not { buildingTag() }
}
}
steps {
sh '''#!/bin/bash
# shellcheck shell=bash
set -x
set -euo pipefail

echo "🚀 Starting Auto Alpha Version Publish 🚀"
echo "==========================================="
echo "📋 Build Info:"
echo " Branch: ${GIT_BRANCH}"
echo " Build Number: ${BUILD_NUMBER}"
echo " Commit: ${GIT_COMMIT:0:8}"
echo "==========================================="

# Configuration
REPO="appcircleio/appcircle-cli"
GIT_USER_EMAIL="ozer@appcircle.io"
GIT_USER_NAME="Özer from Jenkins"

# Install dependencies if needed
echo "📦 Installing dependencies..."
[ ! -d "node_modules" ] && yarn install

# Build the project
echo "⚙️ Building project..."
npm run build

# Run tests
echo "🧪 Running tests..."
npm test

# Configure git
git config user.email "$GIT_USER_EMAIL"
git config user.name "$GIT_USER_NAME"

# Bump alpha version
echo "📈 Bumping alpha version..."
npm run bump:version:alpha

# Get the new version and tag
NEW_VERSION=$(node -p "require('./package.json').version")
TAG="v${NEW_VERSION}"
echo "📌 New version: ${TAG}"

# Push tag to trigger publish stage
echo "📤 Pushing tag ${TAG} to remote..."
git push "https://${GITHUB_PAT}@github.com/${REPO}.git" "$TAG"

echo "✅ Alpha version ${TAG} created and pushed!"
echo "🎯 This will trigger the Publish stage automatically."
echo "==========================================="
'''
}
}

stage('Publish') {
when {
expression { params.PUBLISH == true }
buildingTag()
}
steps {
sh '''#!/bin/bash
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@appcircle/cli",
"version": "2.7.6-alpha.3",
"version": "2.7.6-alpha.4",
"description": "CLI tool for running Appcircle services from the command line",
"main": "bin/appcircle.js",
"bin": {
Expand Down