diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d6237f3..04aaae33 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,7 @@ # This is a basic workflow to automate the creation of the build artifact +# Required GitHub Secrets: +# - ARTIFACTORY_USER: SAP Artifactory username +# - ARTIFACTORY_TOKEN: SAP Artifactory access token name: Release # Controls when the workflow will run on: @@ -24,3 +27,35 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} uses: ./.github/actions/bump-version + - name: Setup Maven + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + - name: Configure Maven Settings + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml << 'EOF' + + + + sap-artifactory + ${env.ARTIFACTORY_USER} + ${env.ARTIFACTORY_TOKEN} + + + + EOF + - name: Get version from package.json + id: version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + - name: Update pom.xml version + run: | + mvn versions:set -DnewVersion=${{ steps.version.outputs.version }} -DgenerateBackupPoms=false + echo "✅ Updated pom.xml to version ${{ steps.version.outputs.version }}" + - name: Deploy to SAP Artifactory + env: + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} + run: | + mvn deploy -DskipTests diff --git a/deploy-to-artifactory.sh b/deploy-to-artifactory.sh new file mode 100755 index 00000000..99e31ea6 --- /dev/null +++ b/deploy-to-artifactory.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Deploy UI5 Inspector to SAP Artifactory +# Usage: ./deploy-to-artifactory.sh + +REPO_BASE="https://common.repositories.cloud.sap/artifactory/ui5-inspector-releases" + +echo "📦 UI5 Inspector - Deploy to Artifactory" +echo "" + +# Check credentials +if [ -z "$ARTIFACTORY_USER" ] || [ -z "$ARTIFACTORY_TOKEN" ]; then + echo "❌ Missing credentials. Set ARTIFACTORY_USER and ARTIFACTORY_TOKEN" + exit 1 +fi + +# Check build artifact +if [ ! -f "package/ui5inspector.zip" ]; then + echo "❌ package/ui5inspector.zip not found. Run 'npm install' first" + exit 1 +fi + +# Get version +VERSION=$(grep '' pom.xml | head -1 | sed 's/.*\(.*\)<\/version>.*/\1/') + +echo "Version: $VERSION" +echo "Artifact: package/ui5inspector.zip ($(du -h package/ui5inspector.zip | cut -f1))" +echo "" + +# Confirm +read -p "Deploy to Artifactory? [y/N] " -n 1 -r +echo "" + +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Cancelled" + exit 0 +fi + +# Deploy +echo "" +echo "Deploying..." +if mvn deploy -DskipTests; then + echo "" + echo "✅ Done! Browse: $REPO_BASE/com/sap/ui5/inspector/package/$VERSION/" +else + echo "" + echo "❌ Deployment failed" + exit 1 +fi diff --git a/pom.xml b/pom.xml index a8f1d2ff..60fa9038 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,10 @@ - + 4.0.0 com.sap.ui5.inspector package - 0.9.10 + 1.7.0 pom UI5 Inspector @@ -18,18 +19,18 @@ - - SAP - http://www.sap.com - + + SAP + http://www.sap.com + - - - UI5 - SAP SE - http://www.sap.com - - + + + UI5 + SAP SE + http://www.sap.com + + @@ -39,4 +40,56 @@ https://github.com/SAP/ui5-inspector + + + + sap-artifactory + SAP Artifactory - UI5 Inspector Releases + https://common.repositories.cloud.sap/artifactory/ui5-inspector-releases + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.6.1 + + + attach-edge-artifact + package + + attach-artifact + + + + + package/ui5inspector.zip + zip + edge + + + + + + attach-chrome-artifact + package + + attach-artifact + + + + + package/ui5inspector.zip + zip + chrome + + + + + + + + diff --git a/scripts/update-version.js b/scripts/update-version.js index fd437b33..dfdf43cd 100644 --- a/scripts/update-version.js +++ b/scripts/update-version.js @@ -6,18 +6,26 @@ console.log('Updating version - ' + args[0]); const packagePath = path.join(path.dirname(__dirname), 'package.json'); const manifestPath = path.join(path.dirname(__dirname), 'app/manifest.json'); +const pomPath = path.join(path.dirname(__dirname), 'pom.xml'); const version = args[0]; const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8')); const manifestJson = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); +const pomXml = fs.readFileSync(pomPath, 'utf8'); packageJson.version = version; manifestJson.version = version; +// Update pom.xml version using regex (targets project version, not plugin versions) +const updatedPomXml = pomXml.replace( + /(package<\/artifactId>\s*\n\s*)[\d.]+(<\/version>)/, + `$1${version}$2` +); + try { fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2)); fs.writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 4)); - //file written successfully + fs.writeFileSync(pomPath, updatedPomXml); console.log('Update successful'); } catch (err) { console.error(err);