Skip to content

Commit 9194ba2

Browse files
authored
repo: Add automated tagging/publishing (envoyproxy#22578)
Signed-off-by: Ryan Northey <[email protected]>
1 parent bcd3d40 commit 9194ba2

File tree

5 files changed

+56
-11
lines changed

5 files changed

+56
-11
lines changed

.azure-pipelines/pipelines.yml

+35-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ trigger:
1010
# PR build config is manually overridden in Azure pipelines UI with different secrets
1111
pr: none
1212

13+
variables:
14+
- name: isDev
15+
# This must be checked/set in a `step` from the VERSION.txt file, in order to be useful
16+
value: true
17+
- name: isMain
18+
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
19+
- name: isRelease
20+
value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/release/v')]
21+
- name: isStableBranch
22+
# A release branch can be either `main` or a `release/v1.x` stable branch
23+
value: $[or(eq(variables['isMain'], 'true'), eq(variables['isRelease'], 'true'))]
24+
1325
stages:
1426
- stage: precheck
1527
jobs:
@@ -425,11 +437,11 @@ stages:
425437
timeoutInMinutes: 10
426438
condition: always()
427439

428-
- stage: docs
440+
- stage: publish
429441
dependsOn: ["docker"]
430442
condition: and(succeeded(), eq(variables['PostSubmit'], true), ne(variables['NoSync'], true))
431443
jobs:
432-
- job: publish
444+
- job: docs
433445
pool:
434446
vmImage: "ubuntu-20.04"
435447
steps:
@@ -458,7 +470,7 @@ stages:
458470
ENVOY_DOCKER_BUILD_DIR: $(Build.StagingDirectory)
459471
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
460472
GCS_ARTIFACT_BUCKET: $(GcsArtifactBucket)
461-
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
473+
condition: eq(variables['isMain'], 'true')
462474
463475
- task: InstallSSHKey@0
464476
inputs:
@@ -474,6 +486,26 @@ stages:
474486
AZP_BRANCH: $(Build.SourceBranch)
475487
NETLIFY_TRIGGER_URL: $(NetlifyTriggerURL)
476488

489+
- job: github
490+
dependsOn: ["docs"]
491+
condition: eq(variables['isStableBranch'], 'true')
492+
pool:
493+
vmImage: "ubuntu-20.04"
494+
steps:
495+
- bash: |
496+
VERSION_DEV="$(cat VERSION.txt | cut -d- -f2)"
497+
if [[ $VERSION_DEV != "dev" ]]; then
498+
echo "##vso[task.setvariable variable=isDev]false"
499+
fi
500+
displayName: Set development/release env
501+
502+
- script: ./ci/run_envoy_docker.sh './ci/do_ci.sh publish'
503+
displayName: "Publish release to Github"
504+
workingDirectory: $(Build.SourcesDirectory)
505+
condition: eq(variables['isDev'], 'false')
506+
env:
507+
GITHUB_TOKEN: $(GitHubPublicRepoOnlyAccessToken)
508+
477509
- stage: verify
478510
dependsOn: ["docker"]
479511
jobs:

ci/do_ci.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -e
88
build_setup_args=""
99
if [[ "$1" == "format" || "$1" == "fix_proto_format" || "$1" == "check_proto_format" || "$1" == "docs" || \
1010
"$1" == "bazel.clang_tidy" || "$1" == "bazel.distribution" \
11-
|| "$1" == "deps" || "$1" == "verify_examples" \
11+
|| "$1" == "deps" || "$1" == "verify_examples" || "$1" == "publish" \
1212
|| "$1" == "verify_distro" ]]; then
1313
build_setup_args="-nofetch"
1414
fi
@@ -521,6 +521,9 @@ elif [[ "$CI_TARGET" == "verify_distro" ]]; then
521521
fi
522522
bazel run "${BAZEL_BUILD_OPTIONS[@]}" //distribution:verify_packages "$PACKAGE_BUILD"
523523
exit 0
524+
elif [[ "$CI_TARGET" == "publish" ]]; then
525+
bazel run "${BAZEL_BUILD_OPTIONS[@]}" //tools/project:publish
526+
exit 0
524527
else
525528
echo "Invalid do_ci.sh target, see ci/README.md for valid targets."
526529
exit 1

tools/base/requirements.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ aiohttp>=3.8.1
44
cffi>=1.15.0
55
colorama
66
coloredlogs
7-
envoy.base.utils>=0.3.6
7+
envoy.base.utils>=0.3.7
88
envoy.code.check>=0.2.1
99
envoy.dependency.check>=0.1.5
1010
envoy.dependency.pip_check>=0.1.2

tools/base/requirements.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ aio-api-bazel==0.0.2 \
2525
--hash=sha256:56e36463d236e477b7e282f2d870185a0b978b50e2c3803c1ebf8b8ac4b18f5b \
2626
--hash=sha256:d3f563b7698e874437d80538a89dd4d79bc37de2e850c846330ae456e3f21dcc
2727
# via -r requirements.in
28-
aio-api-github==0.1.2 \
29-
--hash=sha256:0c9eabf16e60dddd3879c27337f7c31e5582c9144a5aef268941dd08b0ddf342 \
30-
--hash=sha256:144808e4832dfd6895ed1887bd96d9f4d289761ec03ecbeb589434bcce686b33
28+
aio-api-github==0.1.4 \
29+
--hash=sha256:0a09e476ca4eea3d8a0caa861223f170b4a7f4c1b96976574b8d2a282544d353 \
30+
--hash=sha256:9796778d6b7993e7a3b0ba68af46a314091dcbae2ab98e8f42e3dd5631ed7ab3
3131
# via
3232
# envoy-base-utils
3333
# envoy-dependency-check
@@ -309,9 +309,9 @@ docutils==0.16 \
309309
# sphinx
310310
# sphinx-rtd-theme
311311
# sphinx-tabs
312-
envoy-base-utils==0.3.6 \
313-
--hash=sha256:09bab1310ffd133250e484201244eb11ab019ac36362b14f913ce91ecb023cb3 \
314-
--hash=sha256:ad699b94fd7c63088266a5cbc74ff732e653e586b5c1b9002351080c7d850c09
312+
envoy-base-utils==0.3.7 \
313+
--hash=sha256:5c79aa70de6b7014a5b955822eb83324fd222b7cf7bb656e12a018c747b4f2df \
314+
--hash=sha256:ac7850ec1c90253964a5d7f7847a3c3317f9d77607e6f90d1fb5aeb975ac2842
315315
# via
316316
# -r requirements.in
317317
# envoy-code-check

tools/project/BUILD

+10
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ envoy_entry_point(
3535
pkg = "envoy.base.utils",
3636
script = "envoy.project",
3737
)
38+
39+
envoy_entry_point(
40+
name = "publish",
41+
args = [
42+
"publish",
43+
PATH,
44+
],
45+
pkg = "envoy.base.utils",
46+
script = "envoy.project",
47+
)

0 commit comments

Comments
 (0)