Skip to content

Commit 72f3a54

Browse files
authored
Update to node 18 and set bash -e for error catching (#258)
1 parent d77194f commit 72f3a54

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16-alpine
1+
FROM node:18-alpine
22
LABEL "repository"="https://github.com/anothrNick/github-tag-action"
33
LABEL "homepage"="https://github.com/anothrNick/github-tag-action"
44
LABEL "maintainer"="Nick Sjostrom"

entrypoint.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
set -o pipefail
3+
set -eo pipefail
44

55
# config
66
default_semvar_bump=${DEFAULT_BUMP:-minor}
@@ -81,12 +81,12 @@ preTagFmt="^v?[0-9]+\.[0-9]+\.[0-9]+(-$suffix\.[0-9]+)$"
8181
# get latest tag that looks like a semver (with or without v)
8282
case "$tag_context" in
8383
*repo*)
84-
tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$tagFmt" | head -n 1)"
85-
pre_tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$preTagFmt" | head -n 1)"
84+
tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | (grep -E "$tagFmt" || true) | head -n 1)"
85+
pre_tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | (grep -qs -E "$preTagFmt" || true) | head -n 1)"
8686
;;
8787
*branch*)
88-
tag="$(git tag --list --merged HEAD --sort=-v:refname | grep -E "$tagFmt" | head -n 1)"
89-
pre_tag="$(git tag --list --merged HEAD --sort=-v:refname | grep -E "$preTagFmt" | head -n 1)"
88+
tag="$(git tag --list --merged HEAD --sort=-v:refname | (grep -E "$tagFmt" || true) | head -n 1)"
89+
pre_tag="$(git tag --list --merged HEAD --sort=-v:refname | (grep -qs -E "$preTagFmt" || true) | head -n 1)"
9090
;;
9191
* ) echo "Unrecognised context"
9292
exit 1;;
@@ -178,7 +178,7 @@ esac
178178
if $pre_release
179179
then
180180
# get current commit hash for tag
181-
pre_tag_commit=$(git rev-list -n 1 "$pre_tag")
181+
pre_tag_commit=$(git rev-list -n 1 "$pre_tag" || true)
182182
# skip if there are no new commits for pre_release
183183
if [ "$pre_tag_commit" == "$commit" ]
184184
then

0 commit comments

Comments
 (0)