-
Notifications
You must be signed in to change notification settings - Fork 1
Enhance action.yml with releaseMethod input #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7c72a57
dc09b3f
d7bee26
0565a0d
7ce025a
f8de035
0fcf210
a5722da
6a3a7a9
0c8c708
efb237f
51c01cb
be878b2
c45f8b8
95c5ca5
0573904
96b63b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,14 @@ inputs: | |
| app-path: | ||
| description: "Path to the project’s pom.xml file" | ||
| required: true | ||
| release-method: | ||
| description: "Release-Methode = patch, minor oder major" | ||
| required: false | ||
| default: "patch" | ||
| releaseVersion: | ||
| description: "Version to be released" | ||
| required: true | ||
| developmentVersion: | ||
| description: "Next version with snapshot" | ||
| required: true | ||
| required: false | ||
| default: "" | ||
| skipDeployment: | ||
| description: "Skip deployment to Maven Central" | ||
| default: "true" | ||
|
|
@@ -44,6 +46,9 @@ outputs: | |
| artifact-name: | ||
| description: "Name of the artifact upload" | ||
| value: ${{steps.artifact-name.outputs.artifact-name}} | ||
| release-version: | ||
| description: "calculated release version" | ||
| value: ${{steps.maven-release-step.outputs.FINAL_RELEASE_VERSION }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
@@ -97,13 +102,30 @@ runs: | |
| USE_PR: ${{ inputs.use-pr != 'true' }} | ||
| APP_PATH: ${{inputs.app-path}} | ||
| RELEASE_VERSION: ${{ inputs.releaseVersion }} | ||
| DEPLOYMENT_VERSION: ${{ inputs.developmentVersion }} | ||
| RELEASE_METHOD: ${{ inputs.release-method }} | ||
| DARGUMENTS: ${{ inputs.mavenDArgsInput }} | ||
| run: | | ||
| # configure git | ||
| git config --global user.email "github-actions@github.com" | ||
| git config --global user.name "GitHub Actions" | ||
|
|
||
| # get maven artifact id and provide as output | ||
| MVN_ARTIFACT_ID=$(mvn -f ./$APP_PATH/pom.xml org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -DforceStdout | tee /dev/stderr | tail -n 1) | ||
| echo $MVN_ARTIFACT_ID | ||
| echo "MVN_ARTIFACT_ID=$MVN_ARTIFACT_ID" >> $GITHUB_OUTPUT | ||
|
|
||
| MVN_VERSION=$(mvn -f $APP_PATH/pom.xml $MAVEN_CLI_OPTS org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout ) | ||
|
|
||
| if [ -z $RELEASE_VERSION ]; then RELEASE="${MVN_VERSION/-SNAPSHOT/""}"; else RELEASE=$RELEASE_VERSION; fi | ||
| echo $RELEASE | ||
| if [ "$RELEASE_METHOD" == "major" ]; then MAJOR=$( $(echo $RELEASE | awk -F. '{print $1}') + 1 ); else MAJOR=$(echo $RELEASE | awk -F. '{print $1}'); fi | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
RELEASE=1.2.3
MAJOR=$( $(printf '%s\n' "$RELEASE" | awk -F. '{print $1}') + 1 )Repository: it-at-m/lhm_actions Length of output: 196 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "--- action snippet around line 121 ---"
if [ -f action-templates/actions/action-maven-release/action.yml ]; then
sed -n '110,130p' action-templates/actions/action-maven-release/action.yml | nl -ba -v110
else
echo "file not found"
fi
echo "--- usages of MAJOR and RELEASE_METHOD/maven release ---"
rg -n 'MAJOR|RELEASE_METHOD|major|mvn release|set-maven|Maven' action-templates/actions/action-maven-release/action.yml action-templates/actions -S || true
echo "--- relevant file excerpt ---"
wc -l action-templates/actions/action-maven-release/action.yml
cat -n action-templates/actions/action-maven-release/action.yml | sed -n '1,180p'Repository: it-at-m/lhm_actions Length of output: 236 🏁 Script executed: #!/usr/bin/env bash
set -uo pipefail
echo "file_exists=$(test -f action-templates/actions/action-maven-release/action.yml && echo yes || echo no)"
echo "--- action snippet around line 121 ---"
sed -n '110,130p' action-templates/actions/action-maven-release/action.yml | cat -n | sed 's/^//'
echo "--- relevant excerpts for RELEASE_METHOD and MAJOR release construction ---"
grep -nE 'RELEASE_METHOD|MAJOR|SNAPSHOT|VERSION|RELEASE' action-templates/actions/action-maven-release/action.yml | cat -n | sed 's/^//'
echo "--- file length ---"
wc -l < action-templates/actions/action-maven-release/action.yml
echo "--- full action.yml (first 180 lines) ---"
sed -n '1,180p' action-templates/actions/action-maven-release/action.yml | cat -n | sed 's/^//'
echo "--- behavioral probe of current expression ---"
bash -c 'set -euo pipefail; RELEASE=1.2.3; MAJOR=$( $(printf "%s\n" "$RELEASE" | awk -F. "{print \$1}") + 1 ); printf "MAJOR=[%s]\n" "$MAJOR"' || cat /dev/stderr >/tmp/current_expr_err.txt; cat /tmp/current_expr_err.txt
echo "--- behavioral probe of proposed arithmetic expression ---"
bash -c 'set -euo pipefail; RELEASE=1.2.3; MAJOR=$(( $(printf "%s\n" "$RELEASE" | awk -F. "{print \$1}") + 1 )); printf "MAJOR=[%s]\n" "$MAJOR"'Repository: it-at-m/lhm_actions Length of output: 12356 Fix the major-version arithmetic before releasing as
🤖 Prompt for AI Agents |
||
| if [ "$RELEASE_METHOD" == "major" ]; then MINOR=0; elif [ "$RELEASE_METHOD" == "minor" ]; then MINOR=$(( $(echo $RELEASE | awk -F. '{print $2}' ) + 1 )); else MINOR=$(echo $RELEASE | awk -F. '{print $2}' ); fi | ||
| if [ "$RELEASE_METHOD" != "major" ] && [ "$RELEASE_METHOD" != "minor" ]; then PATCH=$(( $(echo $RELEASE | awk -F. '{print $3}') + 1 )); else PATCH=0; fi | ||
|
|
||
| DEVELOPMENT_VERSION=$(echo $MAJOR.$MINOR.$PATCH-SNAPSHOT) | ||
| echo FINAL_RELEASE_VERSION=$RELEASE >> $GITHUB_OUTPUT | ||
| echo "DEVELOPMENT_VERSION=$DEVELOPMENT_VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| # prepare the maven arguments | ||
| MAVEN_ARGS="-DpushChanges=$USE_PR -DremoteTagging=false -DlocalCheckout=true" | ||
| # set maven deploy skip if skipDeployment is true | ||
|
|
@@ -113,13 +135,10 @@ runs: | |
|
|
||
| # run maven release | ||
| mvn release:prepare release:perform -f ./$APP_PATH/pom.xml -B \ | ||
| -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEPLOYMENT_VERSION \ | ||
| -DreleaseVersion=$RELEASE -DdevelopmentVersion=$DEVELOPMENT_VERSION \ | ||
| $MAVEN_ARGS \ | ||
| -Darguments="$DARGUMENTS" | ||
| # get maven artifact id and provide as output | ||
| MVN_ARTIFACT_ID=$(mvn -f ./$APP_PATH/pom.xml org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -q -DforceStdout) | ||
| echo $MVN_ARTIFACT_ID | ||
| echo "MVN_ARTIFACT_ID=$MVN_ARTIFACT_ID" >> $GITHUB_OUTPUT | ||
|
|
||
| - id: artifact-name | ||
| name: Set output variable $GITHUB_OUTPUT | ||
| run: echo "artifact-name=${{hashFiles(format('./{0}/pom.xml', inputs.app-path))}}" >> "$GITHUB_OUTPUT" | ||
|
|
@@ -135,8 +154,8 @@ runs: | |
| if: ${{ inputs.use-pr == 'true' }} | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||
| with: | ||
| title: "chore(${{ inputs.app-path }}): bump release version to ${{ inputs.developmentVersion }}" | ||
| branch: "release-${{ inputs.app-path }}-${{ inputs.developmentVersion }}" | ||
| title: "chore(${{ inputs.app-path }}): bump release version to ${{ steps.maven-release-step.outputs.DEVELOPMENT_VERSION }}" | ||
| branch: "release-${{ inputs.app-path }}-${{ steps.maven-release-step.outputs.DEVELOPMENT_VERSION }}" | ||
| base: "${{ github.ref_name }}" | ||
| body: "This PR is auto-generated" | ||
| assignees: "${{ github.actor }}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Update the documented action contract.
docs/actions.md:441-507still describes callers supplyingdevelopmentVersion, which this action no longer accepts, and does not document the newrelease-method/release-versionflow. Update the example and output list so consumers do not believe they control a development version that is now computed automatically.🤖 Prompt for AI Agents