Skip to content

Commit

Permalink
go back to simple and use git tag git push
Browse files Browse the repository at this point in the history
  • Loading branch information
sbe-arg committed Jun 12, 2023
1 parent 698f1bb commit a794136
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -238,36 +238,8 @@ then
exit 0
fi

# create local git tag
git tag "$new"

# push new tag ref to github
# this needs permissions in the workflow as contents: write
dt=$(date '+%Y-%m-%dT%H:%M:%SZ')
full_name=$GITHUB_REPOSITORY
git_refs_url=$(jq .repository.git_refs_url "$GITHUB_EVENT_PATH" | tr -d '"' | sed 's/{\/sha}//g')

echo "$dt: **pushing tag $new to repo $full_name"

git_refs_response=$(
curl -s -X POST "$git_refs_url" \
-H "Authorization: token $GITHUB_TOKEN" \
-d @- << EOF
{
"ref": "refs/tags/$new",
"sha": "$commit"
}
EOF
)

git_ref_posted=$( echo "${git_refs_response}" | jq .ref | tr -d '"' )

echo "::debug::${git_refs_response}"
if [ "${git_ref_posted}" = "refs/tags/${new}" ]
then
exit 0
else
echo "::error::Tag was not created properly."
exit 1
fi
# create local git tag
git tag -f "$new"
# push local tag
git push -f origin "$new"

0 comments on commit a794136

Please sign in to comment.