Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide execute permissions to entripoint script #716

Merged
merged 6 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 8 additions & 12 deletions .github/actions/github-tag-action/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,18 @@ preTagFmt="^v?[0-9]+\.[0-9]+\.[0-9]+(-$suffix\.[0-9]+)$"

# get latest tag that looks like a semver (with or without v)
case "$tag_context" in
*repo*)
*repo*)
tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$tagFmt" | head -n 1)"
pre_tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$preTagFmt" | head -n 1)"
;;
*branch*)
*branch*)
tag="$(git tag --list --merged HEAD --sort=-v:refname | grep -E "$tagFmt" | head -n 1)"
pre_tag="$(git tag --list --merged HEAD --sort=-v:refname | grep -E "$preTagFmt" | head -n 1)"
;;
* ) echo "Unrecognised context"
exit 1;;
esac

echo "tag_context=$tag_context"

# if there are none, start tags at INITIAL_VERSION
if [ -z "$tag" ]
then
Expand All @@ -112,11 +110,9 @@ fi

# get current commit hash for tag
tag_commit=$(git rev-list -n 1 "$tag")
echo "tag_commit=$tag_commit"

# get current commit hash
commit=$(git rev-parse HEAD)
echo "commit=$commit"

if [ "$tag_commit" == "$commit" ]
then
Expand All @@ -134,22 +130,22 @@ case "$log" in
*$major_string_token* ) new=$(semver -i major "$tag"); part="major";;
*$minor_string_token* ) new=$(semver -i minor "$tag"); part="minor";;
*$patch_string_token* ) new=$(semver -i patch "$tag"); part="patch";;
*$none_string_token* )
*$none_string_token* )
echo "Default bump was set to none. Skipping..."
setOutput "new_tag" "$tag"
setOutput "tag" "$tag"
exit 0;;
* )
* )
if [ "$default_semvar_bump" == "none" ]
then
echo "Default bump was set to none. Skipping..."
setOutput "new_tag" "$tag"
setOutput "tag" "$tag"
exit 0
else
exit 0
else
new=$(semver -i "${default_semvar_bump}" "$tag")
part=$default_semvar_bump
fi
part=$default_semvar_bump
fi
;;
esac

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Version Bump
on:
pull_request:
push:
branches:
- main
Expand Down Expand Up @@ -45,4 +46,5 @@ jobs:
- name: Bump version and push tag
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
DRY_RUN: true
run: .github/actions/github-tag-action/entrypoint.sh