Skip to content

Commit

Permalink
Make: Separates staging and release versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ipsingh06 committed Dec 30, 2020
1 parent 2587b6c commit 80c70f2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,15 @@ jobs:
- name: Push to Dockerhub (tag vX.X.X)
run: make docker-image-release \
STAGING_REGISTRY=${{ env.staging_registry }} \
STAGING_VERSION=${{ env.RELEASE_VERSION }} \
SEEDSYNC_REPO=docker.io/ipsingh06
STAGING_VERSION=${{ github.run_number }} \
RELEASE_REGISTRY=docker.io/ipsingh06 \
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
- name: Push to Dockerhub (tag latest)
run: make docker-image-release \
STAGING_REGISTRY=${{ env.staging_registry }} \
STAGING_VERSION=latest \
SEEDSYNC_REPO=docker.io/ipsingh06
STAGING_VERSION=${{ github.run_number }} \
RELEASE_REGISTRY=docker.io/ipsingh06 \
RELEASE_VERSION=latest

publish-deb:
name: Publish Deb package
Expand Down
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,26 @@ docker-image-release:
export STAGING_REGISTRY="${DEFAULT_STAGING_REGISTRY}"; \
fi;
echo "${green}STAGING_REGISTRY=$${STAGING_REGISTRY}${reset}";

@if [[ -z "${STAGING_VERSION}" ]] ; then \
echo "${red}ERROR: STAGING_VERSION is required${reset}"; exit 1; \
export STAGING_VERSION="latest"; \
fi;
echo "${green}STAGING_VERSION=$${STAGING_VERSION}${reset}";
@if [[ -z "${RELEASE_REGISTRY}" ]] ; then \
echo "${red}ERROR: RELEASE_REGISTRY is required${reset}"; exit 1; \
fi
@if [[ -z "${SEEDSYNC_REPO}" ]] ; then \
echo "${red}ERROR: SEEDSYNC_REPO is required${reset}"; exit 1; \
@if [[ -z "${RELEASE_VERSION}" ]] ; then \
echo "${red}ERROR: RELEASE_VERSION is required${reset}"; exit 1; \
fi
echo "${green}STAGING_VERSION=${STAGING_VERSION}${reset}"
echo "${green}SEEDSYNC_REPO=${SEEDSYNC_REPO}${reset}"
echo "${green}RELEASE_REGISTRY=${RELEASE_REGISTRY}${reset}"
echo "${green}RELEASE_VERSION=${RELEASE_VERSION}${reset}"

# final image
$(DOCKER) buildx build \
-f ${SOURCEDIR}/docker/build/docker-image/Dockerfile \
--target seedsync_run \
--build-arg STAGING_VERSION=$${STAGING_VERSION} \
--build-arg STAGING_REGISTRY=$${STAGING_REGISTRY} \
--tag ${SEEDSYNC_REPO}/seedsync:${STAGING_VERSION} \
--tag ${RELEASE_REGISTRY}/seedsync:${RELEASE_VERSION} \
--cache-from=type=registry,ref=$${STAGING_REGISTRY}/seedsync:cache \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--push \
Expand Down
4 changes: 2 additions & 2 deletions doc/DeveloperReadme.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ make run-tests-e2e STAGING_VERSION=latest SEEDSYNC_ARCH=arm64 STAGING_REGISTRY=i
## Docker image upload to Dockerhub

```bash
make docker-image-release STAGING_VERSION=<version> SEEDSYNC_REPO=ipsingh06
make docker-image-release STAGING_VERSION=latest SEEDSYNC_REPO=ipsingh06
make docker-image-release RELEASE_VERSION=<version> RELEASE_REGISTRY=ipsingh06
make docker-image-release RELEASE_VERSION=latest RELEASE_REGISTRY=ipsingh06
```


Expand Down

0 comments on commit 80c70f2

Please sign in to comment.