Skip to content

Commit

Permalink
Merge pull request #45 from manue1/trunk
Browse files Browse the repository at this point in the history
Add input variable to allow overriding release title
  • Loading branch information
andyfeller authored Sep 27, 2023
2 parents 4d676b7 + 38be18e commit b2a64f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ inputs:
description: "GPG fingerprint to use for signing releases"
release_tag:
description: "Tag that the release should be created from, defaults to `github.ref` if unspecified"
release_title_prefix:
description: "Title prefix of the release, defaults to repository name if unspecified"
branding:
color: purple
icon: box
Expand All @@ -28,9 +30,9 @@ runs:
- id: determine_token
run: |
if [ -n "$INPUT_TOKEN" ]; then
token=$INPUT_TOKEN
token="$INPUT_TOKEN"
else
token=$DEFAULT_TOKEN
token="$DEFAULT_TOKEN"
fi
echo "TOKEN=$token" >> "$GITHUB_OUTPUT"
env:
Expand All @@ -53,12 +55,25 @@ runs:
INPUT_TAG: ${{ inputs.release_tag }}
shell: bash

- id: determine_release_title_prefix
run: |
if [ -n "$INPUT_TITLE" ]; then
prefix="$INPUT_TITLE"
else
prefix="${GITHUB_REPOSITORY#*/}"
fi
echo "PREFIX=$prefix" >> "$GITHUB_OUTPUT"
env:
INPUT_TITLE: ${{ inputs.release_title_prefix }}
shell: bash

- run: ${GITHUB_ACTION_PATH//\\//}/build_and_release.sh
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ steps.determine_token.outputs.TOKEN }}
GPG_FINGERPRINT: ${{ inputs.gpg_fingerprint }}
GH_EXT_BUILD_SCRIPT: ${{ inputs.build_script_override }}
GH_RELEASE_TAG: ${{ steps.determine_release_tag.outputs.TAG }}
GH_RELEASE_TITLE_PREFIX: ${{ steps.determine_release_title_prefix.outputs.PREFIX }}
DRAFT_RELEASE: ${{ inputs.draft_release }}
shell: bash
2 changes: 1 addition & 1 deletion build_and_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ if gh release view "$GH_RELEASE_TAG" >/dev/null; then
gh release upload "$GH_RELEASE_TAG" --clobber -- "${assets[@]}"
else
echo "creating release and uploading assets..."
gh release create "$GH_RELEASE_TAG" $prerelease $draft_release --title="${GITHUB_REPOSITORY#*/} ${GH_RELEASE_TAG#v}" --generate-notes -- "${assets[@]}"
gh release create "$GH_RELEASE_TAG" $prerelease $draft_release --title="${GH_RELEASE_TITLE_PREFIX} ${GH_RELEASE_TAG#v}" --generate-notes -- "${assets[@]}"
fi

0 comments on commit b2a64f6

Please sign in to comment.