Skip to content

Commit

Permalink
Issue #12078: Github action Release prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and romani committed Aug 27, 2022
1 parent c0b12ee commit 527bae7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .ci/maven-prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e

if [[ -z $1 ]]; then
echo "version is not set"
echo "Usage: maven-prepare.sh <version>"
exit 1
fi

TARGET_VERSION=$1
echo TARGET_VERSION="$TARGET_VERSION"

CURRENT_VERSION=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 \
-t -m pom:project -v pom:version pom.xml | sed "s/-SNAPSHOT//")
echo CURRENT_VERSION="$CURRENT_VERSION"

if [ "$TARGET_VERSION" != "$CURRENT_VERSION" ]; then
echo "[ERROR] Target Version and Current Version doesn't match."
exit 1;
fi

SKIP_TEST="-DskipTests -DskipITs"
SKIP_CHECKSTYLE="-Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true"
SKIP_OTHERS="-Dpmd.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Dxml.skip=true"

echo "Version bump in pom.xml (release:prepare) ..."
mvn -e --no-transfer-progress release:prepare -B \
-Darguments="$SKIP_TEST $SKIP_CHECKSTYLE $SKIP_OTHERS"
30 changes: 30 additions & 0 deletions .github/workflows/maven_prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#############################################################################
# GitHub Action to Run Maven Release Prepare.
#
#############################################################################
name: "Maven Release Prepare"
on:
workflow_dispatch:
inputs:
version:
description: 'Target Version without (-SNAPSHOT)'
required: true
jobs:
prepare:
name: Prepare Release ${{ github.event.inputs.version }}
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download xmlstarlet
run: |
sudo apt-get install xmlstarlet
- name: Commit and Push Credentials
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Run Shell Script
run: |
./.ci/maven-prepare.sh ${{ github.event.inputs.version }}

0 comments on commit 527bae7

Please sign in to comment.