Skip to content

Commit

Permalink
fix gh actions build
Browse files Browse the repository at this point in the history
  • Loading branch information
Xziy committed May 4, 2024
1 parent 20acb91 commit 5ef44b3
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@ jobs:
set -x
BRANCH=${GITHUB_REF##*/}
PACKAGE=$(cat package.json | jq -r '.["name"]')
VERNPMRAW=$(curl -s https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].'$BRANCH'')
VERNPM=$(echo $VERNPMRAW | cut -d'-' -f1)
BUILD_VERSION=$(echo $VERNPMRAW | cut -d'.' -f3)
VERLOC=$(cat package.json | jq -r '.["version"]')
VEROUT=$(printf "$VERNPM\n$VERLOC\n" | sort -V -r | awk 'NR==1 {print; exit}')
if [[ ! -z "$VERNPM" ]]; then
if [[ ! -z "$BUILD_VERSION" ]]; then
BUILD_VERSION=$((BUILD_VERSION+1))
else
BUILD_VERSION=1
fi
VERNPMRAW=$(curl -s https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].'$BRANCH'')
BUILD_VERSION=0
if [[ "$VERNPMRAW" == "null" ]]; then
VEROUT=$VERLOC
else
BUILD_VERSION=1
VERNPM=$(echo $VERNPMRAW | cut -d'-' -f1)
BUILD_VERSION=$(echo $VERNPMRAW | awk -F '[.-]' '{print $5+1}')
VEROUT=$(printf "$VERNPM\n$VERLOC\n" | sort -V -r | awk 'NR==1 {print; exit}')
fi
jq -r '.version = "'${VEROUT}'-build.'$BUILD_VERSION'"' package.json > /tmp/package.json && mv /tmp/package.json ./package.json
- run: npm publish --tag ${GITHUB_REF##*/}
Expand Down

0 comments on commit 5ef44b3

Please sign in to comment.