Update build scripts (#550)

This commit is contained in:
Semyon Bezrukov 2022-12-01 14:46:31 +03:00 committed by GitHub
parent 452dd4996d
commit 574b3c92b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 16 deletions

@ -115,18 +115,18 @@ jobs:
BRANCH_NAME=${GITHUB_REF#refs/heads/} BRANCH_NAME=${GITHUB_REF#refs/heads/}
if [ $BRANCH_NAME = develop ]; then if [ $BRANCH_NAME = develop ]; then
RELEASE_BRANCH=unstable BUILD_CHANNEL=nightly
PRODUCT_VERSION=99.99.99 PRODUCT_VERSION=99.99.99
elif [[ $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then elif [[ $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then
RELEASE_BRANCH=testing BUILD_CHANNEL=test
PRODUCT_VERSION=${BRANCH_NAME#*/v} PRODUCT_VERSION=${BRANCH_NAME#*/v}
fi fi
BUILD_NUMBER=${{ github.event.inputs.build }} BUILD_NUMBER=${{ github.event.inputs.build }}
export PRODUCT_EDITION export PRODUCT_EDITION
export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER} export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER}~stretch
export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}/${RELEASE_BRANCH}/ubuntu export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}/${BUILD_CHANNEL}
export RELEASE_BRANCH export BUILD_CHANNEL
export PLATFORM export PLATFORM
export DOCKERFILE=Dockerfile export DOCKERFILE=Dockerfile
export PREFIX_NAME=4testing- export PREFIX_NAME=4testing-

@ -4,28 +4,29 @@ PRODUCT_NAME ?= DocumentServer
PRODUCT_EDITION ?= PRODUCT_EDITION ?=
PRODUCT_VERSION ?= 0.0.0 PRODUCT_VERSION ?= 0.0.0
BUILD_NUMBER ?= 0 BUILD_NUMBER ?= 0
BUILD_CHANNEL ?= nightly
ONLYOFFICE_VALUE ?= onlyoffice ONLYOFFICE_VALUE ?= onlyoffice
S3_BUCKET ?= repo-doc-onlyoffice-com S3_BUCKET ?= repo-doc-onlyoffice-com
RELEASE_BRANCH ?= unstable S3_REGION ?= eu-west-1
COMPANY_NAME_LOW = $(shell echo $(COMPANY_NAME) | tr A-Z a-z) COMPANY_NAME_LOW = $(shell echo $(COMPANY_NAME) | tr A-Z a-z)
PRODUCT_NAME_LOW = $(shell echo $(PRODUCT_NAME) | tr A-Z a-z) PRODUCT_NAME_LOW = $(shell echo $(PRODUCT_NAME) | tr A-Z a-z)
COMPANY_NAME_LOW_ESCAPED = $(subst -,,$(COMPANY_NAME_LOW)) COMPANY_NAME_LOW_ESCAPED = $(subst -,,$(COMPANY_NAME_LOW))
PACKAGE_NAME := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION) PACKAGE_NAME := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)
PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER) PACKAGE_VERSION := $(PRODUCT_VERSION)-$(BUILD_NUMBER)~stretch
PACKAGE_BASEURL := https://s3.eu-west-1.amazonaws.com/$(S3_BUCKET)/$(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/ubuntu PACKAGE_BASEURL := https://s3.$(S3_REGION).amazonaws.com/$(S3_BUCKET)/server/linux/debian/$(BUILD_CHANNEL)
ifeq ($(RELEASE_BRANCH),$(filter $(RELEASE_BRANCH),unstable testing)) ifeq ($(BUILD_CHANNEL),$(filter $(BUILD_CHANNEL),nightly test))
DOCKER_TAG := $(subst -,.,$(PACKAGE_VERSION)) DOCKER_TAG := $(PRODUCT_VERSION).$(BUILD_NUMBER)
else else
DOCKER_TAG := $(subst -,.,$(PACKAGE_VERSION))-$(subst /,-,$(GIT_BRANCH)) DOCKER_TAG := $(PRODUCT_VERSION).$(BUILD_NUMBER)-$(subst /,-,$(GIT_BRANCH))
endif endif
DOCKER_IMAGE := $(subst -,,$(COMPANY_NAME_LOW))/4testing-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION) DOCKER_IMAGE := $(subst -,,$(COMPANY_NAME_LOW))/4testing-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)
DOCKER_DUMMY := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)__$(DOCKER_TAG).dummy DOCKER_DUMMY := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)$(PRODUCT_EDITION)__$(DOCKER_TAG).dummy
DOCKER_ARCH := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)_$(PACKAGE_VERSION).tar.gz DOCKER_ARCH := $(COMPANY_NAME_LOW)-$(PRODUCT_NAME_LOW)_$(DOCKER_TAG).tar.gz
DOCKER_ARCH_URI := $(COMPANY_NAME_LOW)/$(RELEASE_BRANCH)/docker/$(notdir $(DOCKER_ARCH)) DOCKER_ARCH_URI := server/linux/docker/$(BUILD_CHANNEL)/$(notdir $(DOCKER_ARCH))
.PHONY: all clean clean-docker image deploy docker publish .PHONY: all clean clean-docker image deploy docker publish
@ -61,7 +62,7 @@ deploy: $(DOCKER_DUMMY)
for i in {1..3}; do \ for i in {1..3}; do \
docker push $(DOCKER_IMAGE):$(DOCKER_TAG) && break || sleep 1m; \ docker push $(DOCKER_IMAGE):$(DOCKER_TAG) && break || sleep 1m; \
done done
ifeq ($(RELEASE_BRANCH),unstable) ifeq ($(BUILD_CHANNEL),nightly)
docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest
for i in {1..3}; do \ for i in {1..3}; do \
docker push $(DOCKER_IMAGE):latest && break || sleep 1m; \ docker push $(DOCKER_IMAGE):latest && break || sleep 1m; \

@ -46,7 +46,7 @@ variable "PACKAGE_FILE" {
default = "" default = ""
} }
variable "RELEASE_BRANCH" { variable "BUILD_CHANNEL" {
default = "" default = ""
} }
@ -55,7 +55,7 @@ target "documentserver" {
dockerfile = "${DOCKERFILE}" dockerfile = "${DOCKERFILE}"
tags = [ tags = [
"docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}", "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:${TAG}",
equal("unstable",RELEASE_BRANCH) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "", equal("nightly",BUILD_CHANNEL) ? "docker.io/${COMPANY_NAME}/${PREFIX_NAME}${PRODUCT_NAME}${PRODUCT_EDITION}:latest": "",
] ]
platforms = ["${PLATFORM}"] platforms = ["${PLATFORM}"]
args = { args = {