Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions .github/scripts/build_and_push_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,39 @@
set -e

# Print all commands
set -x
set -x

pwd


function readJson {
function readJson {
UNAMESTR=`uname`
if [[ "$UNAMESTR" == 'Linux' ]]; then
SED_EXTENDED='-r'
elif [[ "$UNAMESTR" == 'Darwin' ]]; then
SED_EXTENDED='-E'
fi;
fi

VALUE=`grep -m 1 "\"${2}\"" ${1} | sed ${SED_EXTENDED} 's/^ *//;s/.*: *"//;s/",?//'`

if [ ! "$VALUE" ]; then
echo "Error: Cannot find \"${2}\" in ${1}" >&2;
exit 1;
echo "Error: Cannot find \"${2}\" in ${1}" >&2
exit 1
else
echo $VALUE ;
fi;
echo $VALUE
fi
}

if [ ! -f ./package-lock.json ]; then
echo "package-lock.json not found!"
exit 1;
exit 1
fi

IMAGE_NAME=caprover/cli-caprover
CAPROVER_VERSION=`readJson package.json version` || exit 1;
CAPROVER_VERSION=`readJson package.json version` || exit 1

echo $IMAGE_NAME
echo $CAPROVER_VERSION


# ensure you're not running it on local machine
if [ -z "$CI" ] || [ -z "$GITHUB_REF" ]; then
echo "Running on a local machine! Exiting!"
Expand All @@ -47,12 +45,10 @@ else
echo "Running on CI"
fi


docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

export DOCKER_CLI_EXPERIMENTAL=enabled
docker buildx ls
docker buildx create --name mybuilder
docker buildx use mybuilder

docker buildx build --platform linux/amd64,linux/arm64,linux/arm -t $IMAGE_NAME:$CAPROVER_VERSION -t $IMAGE_NAME:latest -f Dockerfile --push .
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t "$IMAGE_NAME:$CAPROVER_VERSION" \
-t "$IMAGE_NAME:latest" \
-f Dockerfile \
--push \
.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ jobs:
build-publish-docker-hub:
needs: validate-and-publish-npm
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- uses: azure/docker-login@v1
- uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build and push release to Docker Hub
shell: bash
run: ./.github/scripts/build_and_push_release.sh
Loading