dev: use pnpm pkg set version
to write version info
This commit is contained in:
parent
7dfc52b681
commit
74f7ef6b98
3 changed files with 4 additions and 6 deletions
|
@ -46,7 +46,7 @@ COPY . ./
|
|||
# Write version info
|
||||
ARG VERSION
|
||||
ENV VERSION=${VERSION}
|
||||
RUN sed -i -r "s/\"version\": \"([^+]+).*\",$/\"version\": \"\\1+neko:${VERSION}\",/" package.json
|
||||
RUN pnpm pkg set version="${VERSION}"
|
||||
|
||||
# Compile
|
||||
RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pnpm run gulp"
|
||||
|
|
|
@ -24,10 +24,7 @@ fi
|
|||
# write version info
|
||||
say 'Writing version info to package.json...'
|
||||
|
||||
run "$(cat - << EOC
|
||||
sed "s/\"version\": \"\([^+][^+]*\).*\",$/\"version\": \"\\1+neko:$(version)\",/" package.json > package.json.new && mv -- package.json.new package.json
|
||||
EOC
|
||||
)"
|
||||
run "pnpm pkg set version=$(version)"
|
||||
|
||||
say 'Done!'
|
||||
br
|
||||
|
|
|
@ -22,7 +22,8 @@ br() {
|
|||
}
|
||||
|
||||
version() {
|
||||
UPSTREAM_VERSION=$(pnpm pkg get version | sed -e 's/"//g')
|
||||
COMMIT_DATE=$(git show --no-patch --pretty='%cs' FETCH_HEAD | sed -e 's/-//g' | cut -c 3-)
|
||||
COMMIT_HASH_INITIAL=$(printf '%s' "$(git rev-parse FETCH_HEAD)" | cut -c 1)
|
||||
printf '%s.%s' "${COMMIT_DATE}" "${COMMIT_HASH_INITIAL}"
|
||||
printf '%s+neko:%s.%s' "${UPSTREAM_VERSION}" "${COMMIT_DATE}" "${COMMIT_HASH_INITIAL}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue