-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use a dedicated versioning script for container builds
- Loading branch information
Showing
6 changed files
with
104 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# call from the container dir | ||
# ./publish.sh [-w] | ||
# -w option to commit changes | ||
|
||
MODE="$1" | ||
HASH="$(git rev-parse --short HEAD)" | ||
|
||
./version.sh server | ||
if [[ "$MODE" == "-w" ]]; then | ||
./build2.sh -r "ghcr.io/stjude/" server | ||
TAG="$(node -p "require('./server/package.json').version")" | ||
docker push ghcr.io/stjude/ppserver:$TAG-$HASH | ||
docker push ghcr.io/stjude/ppserver:latest | ||
fi | ||
|
||
./version.sh full | ||
if [[ "$MODE" == "-w" ]]; then | ||
./build2.sh -r "ghcr.io/stjude/" full | ||
TAG="$(node -p "require('./full/package.json').version")" | ||
docker push ghcr.io/stjude/ppfull:$TAG-$HASH | ||
docker push ghcr.io/stjude/ppfull:latest | ||
fi | ||
|
||
if [[ "$MODE" == "-w" ]]; then | ||
echo "committing version changes" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "PPTeam CI" | ||
git add --all | ||
ROOTPKGVER=$(node -p "require('../package.json').version") | ||
SERVERPKGVER=$(node -p "require('../server/package.json').version") | ||
FRONTPKGVER=$(node -p "require('../front/package.json').version") | ||
git commit -m "image v$ROOTPKGVER server=$SERVERPKGVER front=$FRONTPKGVER" | ||
git push | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
MODE="" | ||
if (( $# == 0 )); then | ||
echo "Missing subdir argument" | ||
echo "Usage: call from within the container dir | ||
./version.sh [subdir=deps|server|full] [-w] | ||
subdir required, any of the container subdirectory that has a dockerfile | ||
-w option to commit changes | ||
" | ||
exit 1 | ||
fi | ||
|
||
SUBDIR=$1 | ||
MODE="" | ||
if (( $# == 2 )); then | ||
MODE="$2" | ||
fi | ||
|
||
cd .. | ||
# container image builds will use published packages, so no need to the excluded workspaces here | ||
UPDATED=$(./build/bump.js $MODE -x=rust -x=augen -x=server -x=client -x=front) | ||
echo "UPDATED=[$UPDATED]" | ||
cd container/$SUBDIR | ||
|
||
DEPS="dependencies.@sjcrh/proteinpaint-" | ||
if [[ "$(grep containerDeps ./package.json)" != "" ]]; then | ||
DEPS=containerDeps. | ||
fi | ||
|
||
ROOTPKGVER=$(node -p "require('../../package.json').version") | ||
echo "setting $SUBDIR package.version='$ROOTPKGVER'" | ||
npm pkg set version=$ROOTPKGVER | ||
|
||
SERVERPKGVER=$(node -p "require('../../server/package.json').version") | ||
echo "setting $SUBDIR package.${DEPS}server='$SERVERPKGVER'" | ||
npm pkg set "${DEPS}server"=$SERVERPKGVER | ||
|
||
if [[ "$SUBDIR" == "full" ]]; then | ||
FRONTPKGVER=$(node -p "require('../../front/package.json').version") | ||
echo "setting $SUBDIR package.${DEPS}full='$SERVERPKGVER'" | ||
npm pkg set "${DEPS}front"=$FRONTPKGVER | ||
fi | ||
|
||
cd .. |