Skip to content

Commit

Permalink
Add support for several nuget build and publish jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Leskov committed Dec 11, 2021
1 parent 700ad49 commit f63bb14
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 21 deletions.
16 changes: 8 additions & 8 deletions .gflows/libs/job_build_nuget.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@


---
#@ def generate_nuget_build_job_steps(sections):
#@ for step in docker.steps.build(sections.nuget, sections.cache_registry, push = False):
#@ def generate_nuget_build_job_steps(nuget, registry):
#@ for step in docker.steps.build(nuget, registry, push = False):
- #@ step
#@ end
#@ image_tag = tagging.image(sections.cache_registry, sections.nuget)
#@ image_tag = tagging.image(registry, nuget)
- name: Create docker image with nuget packages
run: #@ "docker create {} --name nuget".format(image_tag)
- #@ steps.checkout_private_actions()
- name: Extract nuget packages from docker image
uses: ./.github/actions/docker-extract
with:
filter: #@ "ancestor={}".format(image_tag)
container-path: #@ sections.nuget.container_result_path
container-path: #@ nuget.container_result_path
host-path: ./nuget
- name: Upload nuget packages as artifacts
uses: actions/upload-artifact@v2
Expand All @@ -30,11 +30,11 @@
path: ./nuget
#@ end
---
#@ def generate_nuget_build_job(sections):
#@ steps = generate_nuget_build_job_steps(sections)
#@ def generate_nuget_build_job(nuget, sections):
#@ steps = generate_nuget_build_job_steps(nuget, sections.cache_registry)
#@ needs = ["version"]
#@ needs.extend(dep.get_job_needs(sections.nuget))
#@ return common.generate_job(sections.nuget, steps, None, sections, needs, job_name = "Build "+sections.nuget.name)
#@ needs.extend(dep.get_job_needs(nuget))
#@ return common.generate_job(nuget, steps, None, sections, needs, job_name = "Build "+nuget.name)
#@ end
---

16 changes: 11 additions & 5 deletions .gflows/libs/job_publish_nuget.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
run: dotnet nuget push ./nuget/*.snupkg --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --source https://nuget.pkg.github.com/covergo/index.json
#@ end
---
#@ def default_nuget_dependencies(sections):
#@ def default_nuget_dependencies(nuget, sections):
- #@ "nuget-build-" + nuget.slug
#@ if hasattr(nuget,"publish_after"):
#@ for needs_to_publish in nuget.publish_after:
- #@ needs_to_publish
#@ end
#@ return
#@ end
#@ if hasattr(sections,"integration_test"):
#@ for integration_test_run_job_name in dep.get_integration_tests_run_jobs(sections.integration_test):
- #@ integration_test_run_job_name
#@ end
#@ end
- nuget-build
#@ if hasattr(sections,"unit_test"):
#@ for unit_test_job_name in dep.get_unit_tests_job_names(sections.unit_test):
- #@ unit_test_job_name
Expand All @@ -36,9 +42,9 @@
#@ end
#@ end
---
#@ def generate_nuget_publish_job(sections):
#@ def generate_nuget_publish_job(nuget, sections):
#@ steps = generate_nuget_publish_job_steps()
#@ needs = default_nuget_dependencies(sections)
#@ return common.generate_job(sections.nuget, steps, None, sections,needs, job_name = "Publish "+sections.nuget.name)
#@ needs = default_nuget_dependencies(nuget, sections)
#@ return common.generate_job(nuget, steps, None, sections,needs, job_name = "Publish "+nuget.name)
#@ end
---
20 changes: 14 additions & 6 deletions .gflows/workflow-configuration/build-publish/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,20 @@ additional_images: #array of docker-build-and-job

#Runs an exising image or build it, extract nuget package and publishes it
nuget: #docker-build-and-job with special treatment of artifact
name: Auth client nuget
slug: auth-nuget
image_name: covergo/auth-nuget
container_result_path: app/nuget
cache_from:
- covergo/auth
- name: Auth client nuget
slug: auth-nuget
image_name: covergo/auth-nuget
container_result_path: app/nuget
cache_from:
- covergo/auth
publish_after:
- acceptance-tests
- name: Auth client nuget with default dependencies
slug: auth-nuget-default
image_name: covergo/auth-nuget-default
container_result_path: app/nuget
cache_from:
- covergo/auth

#Run existing images using compose, custom section
integration_tests_legacy:
Expand Down
15 changes: 13 additions & 2 deletions .gflows/workflows/build-publish/build-publish.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,19 @@


#@ if hasattr(data.values,"nuget"):
#@ jobs["nuget-build"] = generate_nuget_build_job(data.values)
#@ jobs["nuget-publish"]= generate_nuget_publish_job(data.values)
#@ nuget_sections = []
#@
#@ if type(data.values.nuget) != type([]):
#@ nuget_sections.append(data.values.nuget)
#@ else:
#@ nuget_sections = data.values.nuget
#@ end
#@
#@ for nuget_section in nuget_sections:
#@ jobs["nuget-build-"+nuget_section.slug] = generate_nuget_build_job(nuget_section, data.values)
#@ jobs["nuget-publish-"+nuget_section.slug]= generate_nuget_publish_job(nuget_section, data.values)
#@ end
#@
#@ end

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

0 comments on commit f63bb14

Please sign in to comment.