diff --git a/kcls/wf_docker_production.k b/kcls/wf_docker_production.k index 384d1ff..e55480d 100644 --- a/kcls/wf_docker_production.k +++ b/kcls/wf_docker_production.k @@ -17,33 +17,34 @@ _workflow = gw.Workflow { name = "Build docker image and save to latest" uses = "darklab8/fl-darkstat/.github/workflows/deploy-docker-staging.yml@master" } - job = { - name = _workflow_name - needs = ["build"] - steps = [ - ghc.CheckoutRepo - ghc.GetVersionFromTag - ghc.DockerLogin - ghc.InstallDarklabSshKey - docker.Retag(docker.RetagOpts { - image_name = c._image_name - old_tag = "staging" - new_tag = ghc.GetVersionOutput - pull = True - push = True - }) - docker.Retag(docker.RetagOpts { - image_name = c._image_name - old_tag = ghc.GetVersionOutput - new_tag = "production" - push = True - }) - docker.DeploySwarm(docker.DeploySwarmOpts { - image_name = c._image_name - service_name = "darkstat-production" - tag = "production" - }) - ] - } + job = _production_deploy_job } } +_production_deploy_job: gw.Job = { + name = _workflow_name + needs = ["build"] + steps = [ + ghc.CheckoutRepo + ghc.GetVersionFromTag + ghc.DockerLogin + ghc.InstallDarklabSshKey + docker.Retag(docker.RetagOpts { + image_name = c._image_name + old_tag = "staging" + new_tag = ghc.GetVersionOutput + pull = True + push = True + }) + docker.Retag(docker.RetagOpts { + image_name = c._image_name + old_tag = ghc.GetVersionOutput + new_tag = "production" + push = True + }) + docker.DeploySwarm(docker.DeploySwarmOpts { + image_name = c._image_name + service_name = "darkstat-production" + tag = "production" + }) + ] +} diff --git a/kcls/wf_docker_staging.k b/kcls/wf_docker_staging.k index 143a067..8ef4968 100644 --- a/kcls/wf_docker_staging.k +++ b/kcls/wf_docker_staging.k @@ -18,35 +18,36 @@ _workflow = gw.Workflow { } env = ghc.DockerHostEnv jobs = { - job = { - name = _workflow_name - steps = [ - ghc.CheckoutRepoWithCommits - go.InstallGo {} - tf.InstallTaskfile {} - autogit.InstallAutogit {} - autogit.GetVersionStep - ghc.DockerLogin - ghc.InstallDarklabSshKey - docker.Build(docker.BuildOpts {image_name = c._image_name}) - docker.Retag(docker.RetagOpts { - image_name = c._image_name - old_tag = ghc.GetVersionOutput - new_tag = "staging" - push = True - }) - docker.Retag(docker.RetagOpts { - image_name = c._image_name - old_tag = ghc.GetVersionOutput - new_tag = "latest" - push = True - }) - docker.DeploySwarm(docker.DeploySwarmOpts { - image_name = c._image_name - service_name = "darkstat-staging" - tag = "staging" - }) - ] - } + job = _docker_staging_job } } +_docker_staging_job: gw.Job = { + name = _workflow_name + steps = [ + ghc.CheckoutRepoWithCommits + go.InstallGo {} + tf.InstallTaskfile {} + autogit.InstallAutogit {} + autogit.GetVersionStep + ghc.DockerLogin + ghc.InstallDarklabSshKey + docker.Build(docker.BuildOpts {image_name = c._image_name}) + docker.Retag(docker.RetagOpts { + image_name = c._image_name + old_tag = ghc.GetVersionOutput + new_tag = "staging" + push = True + }) + docker.Retag(docker.RetagOpts { + image_name = c._image_name + old_tag = ghc.GetVersionOutput + new_tag = "latest" + push = True + }) + docker.DeploySwarm(docker.DeploySwarmOpts { + image_name = c._image_name + service_name = "darkstat-staging" + tag = "staging" + }) + ] +} diff --git a/kcls/wf_pages_production.k b/kcls/wf_pages_production.k index 05fc848..afed943 100644 --- a/kcls/wf_pages_production.k +++ b/kcls/wf_pages_production.k @@ -16,42 +16,43 @@ _workflow = gw.Workflow { push.tags = ["*"] } jobs = { - job = { - name = "Github Pages Production" - steps = [ - autogit.InstallAutogit {} - ghc.CheckoutRepoWithCommits - go.InstallGo {} - tf.InstallTaskfile {} - templ.InstallTempl {} - templ.GenerateTempl {} - c.TaskfileBuildVersion - ga.Step { - name: "Build Binaries" - run: "task build:bins" - } - autogit.GetChangelogStep {} - ghc.UploadBinariesStep(ghc.UploadBinariesStepOpts { - body = autogit.GetChangelogOutput - files = [ - "dist/darkstat-linux-amd64" - "dist/darkstat-linux-arm64" - "dist/darkstat-macos-amd64" - "dist/darkstat-macos-arm64" - "dist/darkstat-windows-amd64.exe" - "dist/darkstat-windows-arm64.exe" - ] - }) - ghc.TriggerWorkflowDispatch(ghc.TriggerWorkflowDispatchOpts { - repository = "darklab8/fl-data-vanilla" - }) {name = "Repository Dispatch for Vanilla"} - ghc.TriggerWorkflowDispatch(ghc.TriggerWorkflowDispatchOpts { - repository = "darklab8/fl-data-discovery" - }) {name = "Repository Dispatch for Discovery"} - ghc.TriggerWorkflowDispatch(ghc.TriggerWorkflowDispatchOpts { - repository = "darklab8/fl-data-flsr" - }) {name = "Repository Dispatch for FLSR"} - ] - } + job = _pages_production_job } } +_pages_production_job: gw.Job = { + name = "Github Pages Production" + steps = [ + autogit.InstallAutogit {} + ghc.CheckoutRepoWithCommits + go.InstallGo {} + tf.InstallTaskfile {} + templ.InstallTempl {} + templ.GenerateTempl {} + c.TaskfileBuildVersion + ga.Step { + name: "Build Binaries" + run: "task build:bins" + } + autogit.GetChangelogStep {} + ghc.UploadBinariesStep(ghc.UploadBinariesStepOpts { + body = autogit.GetChangelogOutput + files = [ + "dist/darkstat-linux-amd64" + "dist/darkstat-linux-arm64" + "dist/darkstat-macos-amd64" + "dist/darkstat-macos-arm64" + "dist/darkstat-windows-amd64.exe" + "dist/darkstat-windows-arm64.exe" + ] + }) + ghc.TriggerWorkflowDispatch(ghc.TriggerWorkflowDispatchOpts { + repository = "darklab8/fl-data-vanilla" + }) {name = "Repository Dispatch for Vanilla"} + ghc.TriggerWorkflowDispatch(ghc.TriggerWorkflowDispatchOpts { + repository = "darklab8/fl-data-discovery" + }) {name = "Repository Dispatch for Discovery"} + ghc.TriggerWorkflowDispatch(ghc.TriggerWorkflowDispatchOpts { + repository = "darklab8/fl-data-flsr" + }) {name = "Repository Dispatch for FLSR"} + ] +} diff --git a/kcls/wf_pages_staging.k b/kcls/wf_pages_staging.k index 6b378b8..03a2ffb 100644 --- a/kcls/wf_pages_staging.k +++ b/kcls/wf_pages_staging.k @@ -12,22 +12,23 @@ _workflow = gw.Workflow { workflow_dispatch: {} } jobs = { - job = { - name = "Github Pages Staging" - permissions: ghc.PagesPermissions {} - environment: dict(ghc.PagesEnvironment {}) - steps = [ - ghc.CheckoutRepo - cf.NewCheckoutFreelancerOpts(cf.CheckoutArgs { - freelancer_mod = cf._mod_discovery - freelancer_folder = c._freelancer_folder - }) - ] + c.DarkstatBuildAssetsSteps(c.BuildArgs { - site_root = "/fl-darkstat/" - freelancer_folder = c._freelancer_folder - heading = 'DEV ENV fl-darkstat for Freelancer Discovery' - relay_host = "https://darkrelay-staging.dd84ai.com" - }) + ghc.PagesToDeploySteps() - } + job = _pages_staging_job } } +_pages_staging_job: gw.Job = { + name = "Github Pages Staging" + permissions: ghc.PagesPermissions {} + environment: dict(ghc.PagesEnvironment {}) + steps = [ + ghc.CheckoutRepo + cf.NewCheckoutFreelancerOpts(cf.CheckoutArgs { + freelancer_mod = cf._mod_discovery + freelancer_folder = c._freelancer_folder + }) + ] + c.DarkstatBuildAssetsSteps(c.BuildArgs { + site_root = "/fl-darkstat/" + freelancer_folder = c._freelancer_folder + heading = 'DEV ENV fl-darkstat for Freelancer Discovery' + relay_host = "https://darkrelay-staging.dd84ai.com" + }) + ghc.PagesToDeploySteps() +} diff --git a/kcls/wf_test_build.k b/kcls/wf_test_build.k index 43b7e54..c228c1d 100644 --- a/kcls/wf_test_build.k +++ b/kcls/wf_test_build.k @@ -11,20 +11,21 @@ _workflow = gw.Workflow { schedule: [{cron = "0 9 * * *"}] } jobs = { - job = { - name = "Test build" - steps = [ - ghc.CheckoutRepo - cf.NewCheckoutFreelancerOpts(cf.CheckoutArgs { - freelancer_mod = cf._mod_discovery - freelancer_folder = c._freelancer_folder - }) - ] + c.DarkstatBuildAssetsSteps(c.BuildArgs { - site_root = "/fl-darkstat/" - freelancer_folder = c._freelancer_folder - heading = 'DEV ENV fl-darkstat for Freelancer Discovery' - relay_host = "https://darkrelay-staging.dd84ai.com" - }) - } + job = _test_job } } +_test_job: gw.Job = { + name = "Test build" + steps = [ + ghc.CheckoutRepo + cf.NewCheckoutFreelancerOpts(cf.CheckoutArgs { + freelancer_mod = cf._mod_discovery + freelancer_folder = c._freelancer_folder + }) + ] + c.DarkstatBuildAssetsSteps(c.BuildArgs { + site_root = "/fl-darkstat/" + freelancer_folder = c._freelancer_folder + heading = 'DEV ENV fl-darkstat for Freelancer Discovery' + relay_host = "https://darkrelay-staging.dd84ai.com" + }) +}