Skip to content

Commit

Permalink
Allow clean release version without changelist
Browse files Browse the repository at this point in the history
  • Loading branch information
justusbunsi committed Nov 21, 2021
1 parent 57327ca commit 0855b92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ inputs:
By default excludes πŸ“¦πŸ“πŸ‘»πŸš¦ under the assumption these do not normally merit a release.
Ignored when using workflow_dispatch (explicit release); when using the check_run trigger (automatic), the release is skipped unless the draft changelog matches.
default: '[πŸ’₯πŸš¨πŸŽ‰πŸ›βš πŸš€πŸ‘·]|:(boom|tada|construction_worker):'
NO_CHANGELIST:
required: true
description: |
If specified, the release won't have an incremental suffix. Instead it will just be "project.revision" from pom.xml.
By default uses such incremental suffix. Set to a truthy value (e.g. '1') to prevent an incremental suffix.
default: ''
runs:
using: composite
steps:
- run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} MAVEN_USERNAME=${{ inputs.MAVEN_USERNAME }} MAVEN_TOKEN=${{ inputs.MAVEN_TOKEN }} INTERESTING_CATEGORIES='${{ inputs.INTERESTING_CATEGORIES }}' $GITHUB_ACTION_PATH/run.sh
- run: GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }} MAVEN_USERNAME=${{ inputs.MAVEN_USERNAME }} MAVEN_TOKEN=${{ inputs.MAVEN_TOKEN }} INTERESTING_CATEGORIES='${{ inputs.INTERESTING_CATEGORIES }}' NO_CHANGELIST='${{ inputs.NO_CHANGELIST }}' $GITHUB_ACTION_PATH/run.sh
shell: bash
11 changes: 9 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ if [ $GITHUB_EVENT_NAME = check_run ]
then
gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body' | egrep "$INTERESTING_CATEGORIES"
fi

MVN_CHANGELIST_OPTION=-Dset.changelist
if [ -n "${NO_CHANGELIST}" ]
then
MVN_CHANGELIST_OPTION=-Dchangelist=
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)
mvn -B -V -s $GITHUB_ACTION_PATH/settings.xml -ntp -Dstyle.color=always $MVN_CHANGELIST_OPTION -DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/ -Pquick-build -P\!consume-incrementals clean deploy
version=$(mvn -B -ntp $MVN_CHANGELIST_OPTION -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

0 comments on commit 0855b92

Please sign in to comment.