зеркало из https://github.com/mozilla/fxa.git
Merge pull request #15255 from mozilla/FXA-7359
task(CI): Patch package.json version fields to reflect the git tag
This commit is contained in:
Коммит
11d541f263
|
@ -1,5 +1,7 @@
|
|||
FROM node:18.14-slim
|
||||
|
||||
ARG VERSION
|
||||
|
||||
RUN set -x \
|
||||
&& addgroup --gid 10001 app \
|
||||
&& adduser --disabled-password \
|
||||
|
@ -21,4 +23,4 @@ RUN apt-get update && apt-get install -y \
|
|||
COPY --chown=app:app . /fxa
|
||||
USER app
|
||||
WORKDIR /fxa
|
||||
RUN _scripts/base-docker.sh
|
||||
RUN _scripts/base-docker.sh $VERSION
|
||||
|
|
|
@ -3,8 +3,33 @@
|
|||
DIR=$(dirname "$0")
|
||||
cd "$DIR/.."
|
||||
|
||||
VERSION=$1
|
||||
|
||||
if [[ "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Updating version in package.json to ${VERSION}"
|
||||
else
|
||||
echo "Invalid version or no version specified, ${VERSION}. Defaulting to v0.0.0"
|
||||
VERSION="v0.0.0"
|
||||
fi
|
||||
|
||||
# Trim the prefix "v" from the version
|
||||
VERSION=$(echo "${VERSION}" | sed 's/^v//')
|
||||
|
||||
function patchVersion() {
|
||||
if [ -f "package.json" ]; then
|
||||
echo "Updating version in $(pwd)/package.json to ${VERSION}"
|
||||
jq ".version = \"$VERSION\"" package.json > tmp && mv tmp package.json
|
||||
else
|
||||
echo "$(pwd)/package.json not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Update the root package.json file.
|
||||
patchVersion
|
||||
|
||||
# Create version files and update the version field in package.json files.
|
||||
for d in ./packages/*/ ; do
|
||||
(cd "$d" && mkdir -p config && cp ../version.json . && cp ../version.json config)
|
||||
(cd "$d" && mkdir -p config && cp ../version.json . && cp ../version.json config && patchVersion)
|
||||
done
|
||||
|
||||
if [ -f _dev/local-build-env.sh ]; then
|
||||
|
|
|
@ -3,9 +3,16 @@
|
|||
DIR=$(dirname "$0")
|
||||
cd "$DIR"
|
||||
|
||||
# The circle tag often represents a version number. If the tag is present and
|
||||
# its format looks like a semver, ie v1.2.3, then this version will be applied
|
||||
# across all package.json files.
|
||||
if [ -n "${CIRCLE_TAG}" ]; then
|
||||
VERSION="$CIRCLE_TAG"
|
||||
fi
|
||||
|
||||
./create-version-json.sh
|
||||
|
||||
mkdir -p ../artifacts
|
||||
|
||||
echo "Building fxa-builder image..."
|
||||
time (cd .. && docker build -f _dev/docker/builder/Dockerfile -t fxa-builder:latest . &> "artifacts/fxa-builder.log")
|
||||
time (cd .. && docker build -f _dev/docker/builder/Dockerfile --build-arg VERSION=$VERSION -t fxa-builder:latest . &> "artifacts/fxa-builder.log")
|
||||
|
|
Загрузка…
Ссылка в новой задаче