Skip to content

Commit f63bb14

Browse files
author
Andrey Leskov
committed
Add support for several nuget build and publish jobs
1 parent 700ad49 commit f63bb14

File tree

4 files changed

+46
-21
lines changed

4 files changed

+46
-21
lines changed

.gflows/libs/job_build_nuget.lib.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010

1111
---
12-
#@ def generate_nuget_build_job_steps(sections):
13-
#@ for step in docker.steps.build(sections.nuget, sections.cache_registry, push = False):
12+
#@ def generate_nuget_build_job_steps(nuget, registry):
13+
#@ for step in docker.steps.build(nuget, registry, push = False):
1414
- #@ step
1515
#@ end
16-
#@ image_tag = tagging.image(sections.cache_registry, sections.nuget)
16+
#@ image_tag = tagging.image(registry, nuget)
1717
- name: Create docker image with nuget packages
1818
run: #@ "docker create {} --name nuget".format(image_tag)
1919
- #@ steps.checkout_private_actions()
2020
- name: Extract nuget packages from docker image
2121
uses: ./.github/actions/docker-extract
2222
with:
2323
filter: #@ "ancestor={}".format(image_tag)
24-
container-path: #@ sections.nuget.container_result_path
24+
container-path: #@ nuget.container_result_path
2525
host-path: ./nuget
2626
- name: Upload nuget packages as artifacts
2727
uses: actions/upload-artifact@v2
@@ -30,11 +30,11 @@
3030
path: ./nuget
3131
#@ end
3232
---
33-
#@ def generate_nuget_build_job(sections):
34-
#@ steps = generate_nuget_build_job_steps(sections)
33+
#@ def generate_nuget_build_job(nuget, sections):
34+
#@ steps = generate_nuget_build_job_steps(nuget, sections.cache_registry)
3535
#@ needs = ["version"]
36-
#@ needs.extend(dep.get_job_needs(sections.nuget))
37-
#@ return common.generate_job(sections.nuget, steps, None, sections, needs, job_name = "Build "+sections.nuget.name)
36+
#@ needs.extend(dep.get_job_needs(nuget))
37+
#@ return common.generate_job(nuget, steps, None, sections, needs, job_name = "Build "+nuget.name)
3838
#@ end
3939
---
4040

.gflows/libs/job_publish_nuget.lib.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@
1818
run: dotnet nuget push ./nuget/*.snupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --source https://nuget.pkg.github.com/covergo/index.json
1919
#@ end
2020
---
21-
#@ def default_nuget_dependencies(sections):
21+
#@ def default_nuget_dependencies(nuget, sections):
22+
- #@ "nuget-build-" + nuget.slug
23+
#@ if hasattr(nuget,"publish_after"):
24+
#@ for needs_to_publish in nuget.publish_after:
25+
- #@ needs_to_publish
26+
#@ end
27+
#@ return
28+
#@ end
2229
#@ if hasattr(sections,"integration_test"):
2330
#@ for integration_test_run_job_name in dep.get_integration_tests_run_jobs(sections.integration_test):
2431
- #@ integration_test_run_job_name
2532
#@ end
2633
#@ end
27-
- nuget-build
2834
#@ if hasattr(sections,"unit_test"):
2935
#@ for unit_test_job_name in dep.get_unit_tests_job_names(sections.unit_test):
3036
- #@ unit_test_job_name
@@ -36,9 +42,9 @@
3642
#@ end
3743
#@ end
3844
---
39-
#@ def generate_nuget_publish_job(sections):
45+
#@ def generate_nuget_publish_job(nuget, sections):
4046
#@ steps = generate_nuget_publish_job_steps()
41-
#@ needs = default_nuget_dependencies(sections)
42-
#@ return common.generate_job(sections.nuget, steps, None, sections,needs, job_name = "Publish "+sections.nuget.name)
47+
#@ needs = default_nuget_dependencies(nuget, sections)
48+
#@ return common.generate_job(nuget, steps, None, sections,needs, job_name = "Publish "+nuget.name)
4349
#@ end
4450
---

.gflows/workflow-configuration/build-publish/settings.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,20 @@ additional_images: #array of docker-build-and-job
128128

129129
#Runs an exising image or build it, extract nuget package and publishes it
130130
nuget: #docker-build-and-job with special treatment of artifact
131-
name: Auth client nuget
132-
slug: auth-nuget
133-
image_name: covergo/auth-nuget
134-
container_result_path: app/nuget
135-
cache_from:
136-
- covergo/auth
131+
- name: Auth client nuget
132+
slug: auth-nuget
133+
image_name: covergo/auth-nuget
134+
container_result_path: app/nuget
135+
cache_from:
136+
- covergo/auth
137+
publish_after:
138+
- acceptance-tests
139+
- name: Auth client nuget with default dependencies
140+
slug: auth-nuget-default
141+
image_name: covergo/auth-nuget-default
142+
container_result_path: app/nuget
143+
cache_from:
144+
- covergo/auth
137145

138146
#Run existing images using compose, custom section
139147
integration_tests_legacy:

.gflows/workflows/build-publish/build-publish.template.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,19 @@
2525

2626

2727
#@ if hasattr(data.values,"nuget"):
28-
#@ jobs["nuget-build"] = generate_nuget_build_job(data.values)
29-
#@ jobs["nuget-publish"]= generate_nuget_publish_job(data.values)
28+
#@ nuget_sections = []
29+
#@
30+
#@ if type(data.values.nuget) != type([]):
31+
#@ nuget_sections.append(data.values.nuget)
32+
#@ else:
33+
#@ nuget_sections = data.values.nuget
34+
#@ end
35+
#@
36+
#@ for nuget_section in nuget_sections:
37+
#@ jobs["nuget-build-"+nuget_section.slug] = generate_nuget_build_job(nuget_section, data.values)
38+
#@ jobs["nuget-publish-"+nuget_section.slug]= generate_nuget_publish_job(nuget_section, data.values)
39+
#@ end
40+
#@
3041
#@ end
3142

3243
#@ if hasattr(data.values,"service"):

0 commit comments

Comments
 (0)