Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 55 additions & 11 deletions .woodpecker.star
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,18 @@ def main(ctx):

before = beforePipelines(ctx)

stages = pipelinesDependsOn(stagePipelines(ctx), before)
build_title = ctx.build.title.lower() if ctx.build.title else ""

if not stages:
# build_branch = ctx.build.ref.startswith("refs/pull/next-release")
# source_branch = ctx.environ["CI_COMMIT_SOURCE_BRANCH"]
is_release_pr = ("next-release/" in ctx.build.branch)

if is_release_pr:
stages = []
else:
stages = pipelinesDependsOn(stagePipelines(ctx), before)

if not stages and not is_release_pr:
print("Errors detected. Review messages above.")
return []

Expand All @@ -258,6 +267,7 @@ def main(ctx):

def beforePipelines(ctx):
return checkStarlark() + \
check_pr_branch() + \
licenseCheck() + \
pnpmCache(ctx) + \
cacheOpenCloudPipeline(ctx) + \
Expand All @@ -280,6 +290,27 @@ def stagePipelines(ctx):
def afterPipelines(ctx):
return publishRelease(ctx) + [purgeBuildArtifactCache(ctx), purgeOpencloudBuildCache(ctx), purgeBrowserCache(ctx), purgeTracingCache(ctx)] + pipelinesDependsOn(notifyMatrix(), stagePipelines(ctx))

def check_pr_branch():
return [{
"name": "check-pr-branch",
"steps": [
{
"name": "check-release-pr",
"image": "alpine",
"commands": [
'echo "PR source branch: $CI_COMMIT_SOURCE_BRANCH"',
'echo "PR ref: $CI_COMMIT_REF"',
'echo "Prev source branch: $CI_PREV_COMMIT_SOURCE_BRANCH"',
'echo "Prev refspec: $CI_PREV_COMMIT_REFSPEC"',
'echo "Checking if this is a release PR..."',
],
},
],
"when": [
event["pull_request"],
],
}]

def translation_sync(ctx):
return [{
"name": "translation-sync",
Expand Down Expand Up @@ -455,16 +486,29 @@ def buildCacheWeb(ctx):
"workspace": web_workspace,
"steps": restoreBuildArtifactCache(ctx, "pnpm", ".pnpm-store") +
installPnpm() +
[{
"name": "build-web",
"image": OC_CI_NODEJS,
"environment": {
"NO_INSTALL": True,
[
{
"name": "print-branch",
"image": "alpine",
"commands": [
"echo CI_REPO_BRANCH=" + ctx.repo.branch,
"echo CI_BUILD_BRANCH=" + ctx.build.branch,
"echo CI_BUILD_COMMIT=" + ctx.build.commit,
"echo CI_BUILD_REF=" + ctx.build.ref,
"echo CI_BUILD_SENDER=" + ctx.build.sender,
],
},
"commands": [
"make dist",
],
}] +
{
"name": "build-web",
"image": OC_CI_NODEJS,
"environment": {
"NO_INSTALL": True,
},
"commands": [
"make dist",
],
},
] +
rebuildBuildArtifactCache(ctx, "web-dist", "dist"),
"when": [
event["base"],
Expand Down