2019-06-11 02:06:01 +03:00
|
|
|
#!/bin/bash
|
|
|
|
#/ Usage: script/publish
|
|
|
|
#/
|
|
|
|
#/ Build a docker image of the semantic CLI and publish to the GitHub Package Registry
|
|
|
|
|
|
|
|
set -e
|
|
|
|
cd $(dirname "$0")/..
|
|
|
|
|
2019-10-01 00:00:48 +03:00
|
|
|
VERSION="0.8.0.0"
|
2019-06-11 02:06:01 +03:00
|
|
|
BUILD_SHA=$(git rev-parse HEAD 2>/dev/null)
|
|
|
|
DOCKER_IMAGE=docker.pkg.github.com/github/semantic/semantic
|
|
|
|
|
|
|
|
# Build
|
|
|
|
docker build -t $DOCKER_IMAGE .
|
|
|
|
|
|
|
|
# Make sure semantic is in the image.
|
|
|
|
docker run --rm $DOCKER_IMAGE --version
|
|
|
|
|
|
|
|
# Requires that you've logged in to the GPR (e.g. `docker login docker.pkg.github.com`)
|
|
|
|
# https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry
|
|
|
|
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:latest
|
|
|
|
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$VERSION
|
|
|
|
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:sha_$BUILD_SHA
|
|
|
|
docker push $DOCKER_IMAGE:sha_$BUILD_SHA
|
2019-06-11 02:07:47 +03:00
|
|
|
docker push $DOCKER_IMAGE:$VERSION
|
|
|
|
docker push $DOCKER_IMAGE:latest
|