Skip to content

Commit

Permalink
refactor: ci code dedup
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Jan 11, 2025
1 parent 9e119c6 commit d7879d6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 91 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/docker-production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy docker Production
name: Deploy docker production
'on':
push:
tags:
Expand All @@ -7,11 +7,16 @@ name: Deploy docker Production
workflow_dispatch: {}
jobs:
job:
name: Deploy docker Production
name: Deploy docker production
runs-on: ubuntu-22.04
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Get version from tag
run: |
set -x
echo "BUILD_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
id: version
- name: Docker login
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login --username darkwind8 --password-stdin
- name: Install Darklab ssh key
Expand All @@ -27,11 +32,6 @@ jobs:
chmod 600 ~/.ssh/*
ssh-keyscan -H 37.27.207.42 >> ~/.ssh/known_hosts | true
ssh-keyscan -H darkbot >> ~/.ssh/known_hosts | true
- name: Get version from tag
run: |
set -x
echo "BUILD_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
id: version
- name: Build image darkwind8/darkstat
run: |
set -ex
Expand Down
16 changes: 12 additions & 4 deletions kcls/build.k
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import .wf_test_build
import .wf_pages_staging
import .wf_pages_production
import .wf_docker_staging
import .wf_docker_production
import infra.kcls.common.workflow

import yaml

_image_name = "darkwind8/darkstat"
_workflows = [
wf_test_build._workflow
wf_pages_staging._workflow
wf_pages_production._workflow
wf_docker_staging._workflow
wf_docker_production._workflow
workflow.DockerDeploySwarm(workflow.DockerDeploySwarmOpts {
image_name = _image_name
service_name = "darkstat"
environment = "staging"
})
workflow.DockerDeploySwarm(workflow.DockerDeploySwarmOpts {
image_name = _image_name
service_name = "darkstat"
environment = "production"
})
]

_run = [yaml.dump_to_file(a, ".github/workflows/${a._filename}", ignore_private=True, ignore_none=True) for a in _workflows]
1 change: 0 additions & 1 deletion kcls/common.k
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import infra.kcls.actions.install_templ as templ
import infra.kcls.actions.patch_disco as disco

_freelancer_folder = r"${{ github.workspace }}/fl-data"
_image_name = "darkwind8/darkstat"

schema BuildArgs:
site_root: str
Expand Down
38 changes: 0 additions & 38 deletions kcls/wf_docker_production.k

This file was deleted.

41 changes: 0 additions & 41 deletions kcls/wf_docker_staging.k

This file was deleted.

0 comments on commit d7879d6

Please sign in to comment.