Skip to content

Commit

Permalink
Remove initial input (#4)
Browse files Browse the repository at this point in the history
This is a breaking change.
svu v1.9.0 now [assumes an initial version of 0.0.0][0-ver], so rely on
that functionality instead.
Removing `initial` also means you cannot start at a version other than
0.0.0 either.

[0-ver]: caarlos0/svu#43
  • Loading branch information
jsok committed Jan 3, 2022
1 parent 62c45b9 commit 54676a3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ghcr.io/caarlos0/svu:v1.8.0
FROM ghcr.io/caarlos0/svu:v1.9.0
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ Defaults to `next`, but also supports: `major`, `minor` or `patch`.

**Optional**: Invokes `svu --prefix`'s behaviour, defaults to `v`.

## `initial`

If this is not set, the action will fail if the current version cannot be determined.
Otherwise this SemVer will be used as the initial version.

## Outputs

## `version`
Expand All @@ -40,15 +35,6 @@ with:
bump: 'next'
```

## Set an initial version

```yaml
uses: jsok/svu-version-bump-action@v1
with:
bump: 'next'
initial: '0.0.1'
```

## Custom pattern and prefix

```yaml
Expand All @@ -57,5 +43,4 @@ with:
bump: 'next'
pattern: 'foo/*'
prefix: 'foo/v'
initial: '0.0.1'
```
4 changes: 0 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ inputs:
description: 'Tag prefix'
required: false
default: 'v'
initial:
description: 'Initial version to set if the current version cannot be found'
required: false
outputs:
version:
description: 'Next version'
Expand All @@ -28,4 +25,3 @@ runs:
- ${{ inputs.bump }}
- ${{ inputs.pattern }}
- ${{ inputs.prefix }}
- ${{ inputs.initial }}
12 changes: 2 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,14 @@ set -eu
BUMP=$1
PATTERN=$2
PREFIX=$3
INITIAL=${4:-}

if svu --pattern="${PATTERN}" --prefix="${PREFIX}" current 2>/dev/null 1>/dev/null
then
version="$(svu --pattern="${PATTERN}" --prefix="${PREFIX}" "${BUMP}")"
version_without_prefix="$(svu --pattern="${PATTERN}" --prefix="${PREFIX}" --strip-prefix "${BUMP}")"
else
if [ -n "${INITIAL}" ]
then
echo "::warning Could not find a current version, initialising version to ${INITIAL}"
version="${PREFIX}${INITIAL}"
version_without_prefix="${INITIAL}"
else
echo "::error Could not find a current version!"
exit 1
fi
echo "::error Could not find a current version!"
exit 1
fi
echo "::group::Next version"
echo "${version}"
Expand Down

0 comments on commit 54676a3

Please sign in to comment.