-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support maven-release-plugin
#14
Changes from all commits
59e4b84
1c64dab
61ca6c8
2cde3bf
95dab74
28ee2e3
86ee9eb
f0f1317
a9f5853
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 |
---|---|---|
|
@@ -5,8 +5,22 @@ then | |
gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body' | egrep "$INTERESTING_CATEGORIES" | ||
fi | ||
export MAVEN_OPTS=-Djansi.force=true | ||
mvn -B -V -s $GITHUB_ACTION_PATH/settings.xml -ntp -Dstyle.color=always -Dset.changelist -DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/ -Pquick-build -P\!consume-incrementals clean deploy | ||
version=$(mvn -B -ntp -Dset.changelist -Dexpression=project.version -q -DforceStdout help:evaluate) | ||
gh api -F ref=refs/tags/$version -F sha=$GITHUB_SHA /repos/$GITHUB_REPOSITORY/git/refs | ||
release=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .id') | ||
gh api -X PATCH -F draft=false -F name=$version -F tag_name=$version /repos/$GITHUB_REPOSITORY/releases/$release | ||
if fgrep -sq changelist.format .mvn/maven.config | ||
then # JEP-229 | ||
mvn -B -V -s $GITHUB_ACTION_PATH/settings.xml -ntp -Dstyle.color=always -Dset.changelist -DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/ -Pquick-build -P\!consume-incrementals clean deploy | ||
version=$(mvn -B -ntp -Dset.changelist -Dexpression=project.version -q -DforceStdout help:evaluate) | ||
gh api -F ref=refs/tags/$version -F sha=$GITHUB_SHA /repos/$GITHUB_REPOSITORY/git/refs | ||
name=next | ||
tag=$version | ||
else # MRP | ||
git config --global user.email cd@jenkins.io | ||
git config --global user.name jenkins-maven-cd-action | ||
git config --global url.https://github.com/.insteadOf git@github.com: | ||
mvn -B -V -s $GITHUB_ACTION_PATH/settings.xml -ntp -Dstyle.color=always -P\!consume-incrementals -Darguments='-Pquick-build -ntp' validate release:prepare release:perform | ||
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. Of you are running a quick build you should probably just run validate as the preparation goal? 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. The preparation goals verify that the artifact can actually be packaged. We also run 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. I believe the action would have issues with branch protection 😢 Don't see this ever working unless you go around each repository and allow GitHub action bot to push commits past branch protections. 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. See: #14 (comment) 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. (and #14 (comment)) 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. Maybe this gha could be used to try to pass over branch protections? 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. https://github.com/marketplace/actions/branch-protection-bot makes it doable. Especially since we introduced https://github.com/jenkins-infra/github-reusable-workflows 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. Although the GitHub action only removes include administrators, it does not remove branch protection entirely with status checks. I believe you could create an GitHub action to retrieve current branch protect. 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. IIUC https://github.com/marketplace/actions/branch-protection-bot#access_token cannot use 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. I just read through https://github.community/t/how-to-push-to-protected-branches-in-a-github-action/16101?u=jglick and https://github.community/t/allowing-github-actions-bot-to-push-to-protected-branch/16536?u=jglick and there really does not appear to be any satisfactory solution currently: if you want to use MRP, you must either give up on having protected branches (bad) or use a bot’s PAT (worse). |
||
git checkout HEAD^ # tagged version, rather than prepare for next development version | ||
version=$(mvn -B -ntp -Dexpression=project.version -q -DforceStdout help:evaluate) | ||
name=$version # TODO why does this work differently than in JEP-229? | ||
tag=$(git describe HEAD) # typically ${project.artifactId}-${version} | ||
fi | ||
release=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r --arg name $name '.[] | select(.draft == true and .name == $name) | .id') | ||
gh api -X PATCH -F draft=false -F name=$version -F tag_name=$tag /repos/$GITHUB_REPOSITORY/releases/$release |
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.
https://github.com/jenkins-infra/jenkins-maven-cd-action/pull/14/files?w=1
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.
Would it be better to make this a configuration option so that people who missed incrementals don’t accidentally go this route?
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.
Or did incrementalify (e.g. via
archetypes
), but did not set upchangelist.format
. Yeah that is probably wise.