Skip to content

Commit

Permalink
feat: add input for dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
sergejomon authored and oknozor committed Jan 24, 2025
1 parent a95cd3b commit 9f04182
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ Here are all the inputs available through `with`:
| `verify` | Check a string input against the conventional commit specification but do not create any commit. | `false` |
| `profile` | Specify the bump profil to use for release | null |
| `package` | Specify which package to use for release | null |
| `dry-run` | Perform a release using `cog bump --auto --dry-run` | `false` |
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ inputs:
description: Specify which package to use for release
required: false
default: ''
dry-run:
description: Perform a release dry run
required: false
default: 'false'

outputs:
version:
Expand Down Expand Up @@ -80,4 +84,5 @@ runs:
${{ inputs.git-user-email }} \
${{ inputs.verify }} \
${{ inputs.profile }} \
${{ inputs.package }}
${{ inputs.package }} \
${{ inputs.dry-run }}
21 changes: 21 additions & 0 deletions cog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GIT_USER_EMAIL="${5}"
VERIFY="${6}"
PROFILE="${7}"
PACKAGE="${8}"
DRY_RUN="${9}"

echo "Setting git user : ${GIT_USER}"
git config --global user.name "${GIT_USER}"
Expand Down Expand Up @@ -54,6 +55,26 @@ if [ "$RELEASE" = "true" ]; then
echo "version=$VERSION" >>$GITHUB_OUTPUT
fi

if [ "$DRY_RUN" = "true" ]; then
if [ "$PACKAGE" != '' ]; then
if [ "$PROFILE" != '' ]; then
echo "packge=${PACKAGE} profile=${PROFILE}"
cog bump --auto -H $PROFILE --package $PACKAGE --dry-run|| exit 1
else
cog bump --auto --package $PACKAGE --dry-run|| exit 1
fi
else
if [ "$PROFILE" != '' ]; then
echo "profile=${PROFILE}"
cog bump --auto -H $PROFILE --dry-run || exit 1
else
cog bump --auto --dry-run|| exit 1
fi
fi
VERSION="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
echo "version=$VERSION" >>$GITHUB_OUTPUT
fi

if (echo "${VERIFY}" | grep -Eiv '^([01]|(true)|(false))$' >/dev/null); then
cog verify "${VERIFY}" || exit 1
fi

0 comments on commit 9f04182

Please sign in to comment.