Skip to content

Commit

Permalink
ci: publish release version on GitHub Release creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ScarletFlash committed Nov 10, 2024
1 parent a3439a2 commit ae2cdc3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ jobs:
cd dist
CURRENT_VERSION=$(grep --only-matching --perl-regexp '"version":\s*"\K[^"]+' package.json)
TARGET_VERSION="$CURRENT_VERSION-sha.${{github.sha}}"
if [ "${{github.event_name}}" = "release" ]; then
TARGET_VERSION="$CURRENT_VERSION"
else
TARGET_VERSION="$CURRENT_VERSION-sha.${{github.sha}}"
fi
if pnpm view flat-provider@"${TARGET_VERSION}" > /dev/null 2>&1; then
echo "Version already exists. Skipping publish."
else
pnpm version ${TARGET_VERSION}
pnpm version ${TARGET_VERSION} --allow-same-version
pnpm config set //registry.npmjs.org/:_authToken ${NODE_AUTH_TOKEN}
pnpm publish --access public --no-git-checks
fi
Expand Down

0 comments on commit ae2cdc3

Please sign in to comment.