Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…en-cd-action into errors
  • Loading branch information
jglick committed Feb 7, 2023
2 parents 8615bb9 + 8a7dfc0 commit 09530c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 11 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ description: Deploys a Maven project to the Jenkins Artifactory repository in co
inputs:
GITHUB_TOKEN:
required: true
description: Token to run with, defaults to the repository GITHUB_TOKEN
MAVEN_USERNAME:
required: true
description: Maven username used for deploying the plugin jar to Jenkins Artifactory Repository
MAVEN_TOKEN:
required: true
description: Maven token used for deploying the plugin jar to Jenkins Artifactory Repository
INTERESTING_CATEGORIES:
required: true
description: |
Regexp of emojis from https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.yml representing changes of interest to users.
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):'
default: '[💥🚨🎉🐛⚠🚀🌐👷]|:(boom|tada|construction_worker):'
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
steps:
- run: $GITHUB_ACTION_PATH/run.sh
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ inputs.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ inputs.MAVEN_TOKEN }}
INTERESTING_CATEGORIES: ${{ inputs.INTERESTING_CATEGORIES }}
8 changes: 6 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
set -euxo pipefail
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"
gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '[ .[] | select(.draft == true and .name == "next")] | max_by(.id).body' | egrep "$INTERESTING_CATEGORIES"
fi
export MAVEN_OPTS=-Djansi.force=true
mvn -B -V -e -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)
# Create the annotated git tag - https://docs.github.com/en/rest/git/tags#create-a-tag-object
gh api -F tag=$version -F message=$version -F object=$GITHUB_SHA -F type=commit /repos/$GITHUB_REPOSITORY/git/tags
# Create the git reference associated to the annotated git tag - https://docs.github.com/en/rest/git/refs#create-a-reference
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')
# Publish the GitHub draft release and associate it with the git tag - https://docs.github.com/en/rest/releases/releases#update-a-release
release=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '[ .[] | select(.draft == true and .name == "next").id] | max')
gh api -X PATCH -F draft=false -F name=$version -F tag_name=$version /repos/$GITHUB_REPOSITORY/releases/$release

0 comments on commit 09530c0

Please sign in to comment.