Skip to content

Commit

Permalink
Merge pull request #56 from SuperITMan/bugfix/fix-ci-release-publish
Browse files Browse the repository at this point in the history
Bugfix/fix ci release publish
  • Loading branch information
mhenkens authored Sep 20, 2024
2 parents fb41f69 + d6377c0 commit c6dd483
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions release-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DRY_RUN=false
PACKAGE=ngx-form-errors

EXPECTED_REPOSITORY="NationalBankBelgium/ngx-form-errors"
GH_ACTIONS_TAG=${GH_ACTIONS_TAG:-""}
GITHUB_REF=${GITHUB_REF:-""}

#----------------------------------------------
# Uncomment block below to test locally
Expand All @@ -29,7 +29,7 @@ GH_ACTIONS_TAG=${GH_ACTIONS_TAG:-""}
#touch ${LOGS_FILE}
#GITHUB_ACTIONS=true
#GITHUB_REPOSITORY="NationalBankBelgium/ngx-form-errors"
#GH_ACTIONS_TAG="fooBar"
#GITHUB_REF="refs/tags/fooBar"
#----------------------------------------------

readonly currentDir=$(cd $(dirname $0); pwd)
Expand Down Expand Up @@ -89,7 +89,7 @@ if [[ ${GITHUB_ACTIONS} == true ]]; then

logInfo "Verifying if this build has been triggered for a tag"

if [[ ${GH_ACTIONS_TAG} == "" ]]; then
if [[ ${GITHUB_REF} == refs/tags/* ]]; then
logInfo "Not publishing because this is not a build triggered for a tag" 1
exit 0;
else
Expand All @@ -115,8 +115,13 @@ ghActionsGroupStart "publishing: ${PACKAGE}" "no-xtrace"
for file in ${TGZ_FILES}; do
logInfo "Publishing TGZ file: ${TGZ_FILES}" 2
if [[ ${DRY_RUN} == false ]]; then
logTrace "Publishing the release (with tag latest)" 2
npm publish ${file} --access public
if [[ ${GITHUB_REF} =~ /(alpha|beta|rc)/ ]]; then
logTrace "Publishing the release (with tag next)" 2
npm publish ${file} --tag next --access public
else
logTrace "Publishing the release (with tag latest)" 2
npm publish ${file} --access public
fi
else
logTrace "DRY RUN, skipping npm publish!" 2
fi
Expand Down

0 comments on commit c6dd483

Please sign in to comment.