Przeglądaj źródła

Merge pull request #4374 from overleaf/jpa-support-main-branch

[misc] add support for main branch

GitOrigin-RevId: 0720706674db329d7f1ddb8e829da076b86c75f8
nate stemen 5 lat temu
rodzic
commit
397a3d97df

+ 2 - 0
services/web/Makefile

@@ -433,6 +433,7 @@ format_in_docker:
 IMAGE_CI ?= ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
 IMAGE_REPO ?= gcr.io/overleaf-ops/$(PROJECT_NAME)
 IMAGE_REPO_BRANCH ?= $(IMAGE_REPO):$(BRANCH_NAME)
+IMAGE_REPO_MAIN ?= $(IMAGE_REPO):main
 IMAGE_REPO_MASTER ?= $(IMAGE_REPO):master
 IMAGE_REPO_FINAL ?= $(IMAGE_REPO_BRANCH)-$(BUILD_NUMBER)
 
@@ -441,6 +442,7 @@ export SENTRY_RELEASE ?= ${COMMIT_SHA}
 build_deps:
 	docker build --pull \
 		--cache-from $(IMAGE_REPO_BRANCH)-deps \
+		--cache-from $(IMAGE_REPO_MAIN)-deps \
 		--cache-from $(IMAGE_REPO_MASTER)-deps \
 		--tag $(IMAGE_REPO_BRANCH)-deps \
 		--target deps \

+ 3 - 3
services/web/bin/cdn_upload

@@ -44,8 +44,8 @@ function upload_into_bucket() {
 
 }
 
-# Upload to staging CDN if branch is either 'master' or 'staging-master'
-if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" ]]; then
+# Upload to staging CDN if branch is either 'master' or 'staging-master' or main variants
+if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" || "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == "staging-main" ]]; then
   tar --directory=/tmp/ -xf build.tar
 
   # delete source maps
@@ -53,7 +53,7 @@ if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" ]]; then
 
   upload_into_bucket $CDN_STAG
   # Only upload to production CDN if branch is
-  if [[ "$BRANCH_NAME" == "master" ]]; then
+  if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "main" ]]; then
     upload_into_bucket $CDN_PROD
   fi
 fi

+ 5 - 1
services/web/bin/push-translations-changes.sh

@@ -1,10 +1,14 @@
 #!/bin/bash
 set -e
 
+if [[ -z "$BRANCH_NAME" ]]; then
+  BRANCH_NAME=master
+fi
+
 if [[ `git status --porcelain=2 locales/` ]]; then
   git add locales/*
   git commit -m "auto update translation"
-  git push $UPSTREAM_REPO HEAD:master
+  git push "$UPSTREAM_REPO" "HEAD:$BRANCH_NAME"
 else
   echo 'No changes'
 fi

+ 1 - 1
services/web/bin/sentry_upload

@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 
-if [[ "$BRANCH_NAME" == "master" ]]; then
+if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "main" ]]; then
   rm -rf sentry_upload
   mkdir sentry_upload
   tar --directory sentry_upload -xf build.tar