From 8a7dfc0f3424eb752607c07508b4dfae0e3f9d01 Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Tue, 13 Sep 2022 19:10:45 +0200 Subject: [PATCH] feat: create an annotated tag instead of a ligthweight tag to ensure the correct timestamp (#26) * feat: create an annotated tag instead of a ligthweight tag * Update run.sh * Update run.sh --- run.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run.sh b/run.sh index 053f370..1665cb0 100755 --- a/run.sh +++ b/run.sh @@ -7,6 +7,10 @@ fi export MAVEN_OPTS=-Djansi.force=true mvn -B -V -s $GITHUB_ACTION_PATH/settings.xml -ntp -Dstyle.color=always -Dset.changelist -DaltDeploymentRepository=maven.jenkins-ci.org::default::https://repo.jenkins-ci.org/releases/ -Pquick-build -P\!consume-incrementals clean deploy version=$(mvn -B -ntp -Dset.changelist -Dexpression=project.version -q -DforceStdout help:evaluate) +# Create the annotated git tag - https://docs.github.com/en/rest/git/tags#create-a-tag-object +gh api -F tag=$version -F message=$version -F object=$GITHUB_SHA -F type=commit /repos/$GITHUB_REPOSITORY/git/tags +# Create the git reference associated to the annotated git tag - https://docs.github.com/en/rest/git/refs#create-a-reference gh api -F ref=refs/tags/$version -F sha=$GITHUB_SHA /repos/$GITHUB_REPOSITORY/git/refs +# Publish the GitHub draft release and associate it with the git tag - https://docs.github.com/en/rest/releases/releases#update-a-release release=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '[ .[] | select(.draft == true and .name == "next").id] | max') gh api -X PATCH -F draft=false -F name=$version -F tag_name=$version /repos/$GITHUB_REPOSITORY/releases/$release