diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26b8e36..cf5aeb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,6 @@ on: - 'master' - jobs: build-frontend: runs-on: ubuntu-latest diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml index 8ad52f0..0a4b0d3 100644 --- a/.github/workflows/build/action.yml +++ b/.github/workflows/build/action.yml @@ -1,4 +1,4 @@ -name: 'deploy' +name: 'build' input: tag: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..8b76dad --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: deploy + +on: + push: + branches: + - 'master' + +jobs: + deploy-frontend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: deploy frontend + uses: ./.github/workflows/deploy + with: + tag: frontend + config: ${{ secrets.KUBE_CONFIG }} + + deploy-backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: deploy backend + uses: ./.github/workflows/deploy + with: + tag: frontend + kubeconfig: ${{ secrets.KUBE_CONFIG }} + config: ${{ secrets.BACKEND_TESTING_PROPERTIES }} diff --git a/.github/workflows/deploy/action.yml b/.github/workflows/deploy/action.yml new file mode 100644 index 0000000..e3f1c69 --- /dev/null +++ b/.github/workflows/deploy/action.yml @@ -0,0 +1,22 @@ +name: 'deploy' + +input: + tag: + kubeconfig: + config: + +permissions: + packages: write + +runs: + using: "composite" + steps: + - name: config + shell: bash + run: echo "${{ inputs.config }}" > ./${{ inputs.tag }}/deployment/config.properties + - name: apply + uses: actions-hub/kubectl@master + env: + KUBE_CONFIG: ${{ inputs.kubeconfig }} + with: + args: apply -k ./${{ inputs.tag }}/deployment diff --git a/backend/deployment/base/kustomization.yml b/backend/deployment/base/kustomization.yml deleted file mode 100644 index 81ac427..0000000 --- a/backend/deployment/base/kustomization.yml +++ /dev/null @@ -1,6 +0,0 @@ -configMapGenerator: -- name: cicd - envs: [cicd.env] - -resources: - - deployment.yml \ No newline at end of file diff --git a/backend/deployment/base/deployment.yml b/backend/deployment/deployment.yml similarity index 100% rename from backend/deployment/base/deployment.yml rename to backend/deployment/deployment.yml diff --git a/backend/deployment/kustomization.yml b/backend/deployment/kustomization.yml new file mode 100644 index 0000000..1437994 --- /dev/null +++ b/backend/deployment/kustomization.yml @@ -0,0 +1,6 @@ +configMapGenerator: +- name: mycowgame-com-backend + env: config.properties + +resources: + - deployment.yml \ No newline at end of file diff --git a/backend/deployment/overlays/production/kustomization.yml b/backend/deployment/overlays/production/kustomization.yml deleted file mode 100644 index 2b4a1b8..0000000 --- a/backend/deployment/overlays/production/kustomization.yml +++ /dev/null @@ -1,27 +0,0 @@ -namespace: mycowgame-com-backend-production - -bases: - - ../../base - -configMapGenerator: -- name: mycowgame-com-backend - env: config.properties - -resources: - - namespace.yml - -images: -- name: ghcr.io/jnewb1/mycowgame.com/backend - newName: ghcr.io/jnewb1/mycowgame.com/backend/main - -patches: - - target: - kind: Ingress - name: mycowgame-com-backend - patch: |- - - op: replace - path: /spec/rules/0/host - value: api.mycowgame.com - - op: replace - path: /spec/tls/0/hosts/0 - value: api.mycowgame.com \ No newline at end of file diff --git a/backend/deployment/overlays/production/namespace.yml b/backend/deployment/overlays/production/namespace.yml deleted file mode 100644 index ff3145e..0000000 --- a/backend/deployment/overlays/production/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: mycowgame-com-backend-production \ No newline at end of file diff --git a/backend/deployment/overlays/staging/kustomization.yml b/backend/deployment/overlays/staging/kustomization.yml deleted file mode 100644 index cde886a..0000000 --- a/backend/deployment/overlays/staging/kustomization.yml +++ /dev/null @@ -1,27 +0,0 @@ -namespace: mycowgame-com-backend-staging - -bases: - - ../../base - -configMapGenerator: -- name: mycowgame-com-backend - env: config.properties - -resources: - - namespace.yml - -images: -- name: ghcr.io/jnewb1/mycowgame.com/backend - newName: ghcr.io/jnewb1/mycowgame.com/backend/main - -patches: - - target: - kind: Ingress - name: mycowgame-com-backend - patch: |- - - op: replace - path: /spec/rules/0/host - value: api.staging.mycowgame.com - - op: replace - path: /spec/tls/0/hosts/0 - value: api.staging.mycowgame.com \ No newline at end of file diff --git a/backend/deployment/overlays/staging/namespace.yml b/backend/deployment/overlays/staging/namespace.yml deleted file mode 100644 index 75c8c44..0000000 --- a/backend/deployment/overlays/staging/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: mycowgame-com-backend-staging \ No newline at end of file diff --git a/backend/deployment/overlays/testing/kustomization.yml b/backend/deployment/overlays/testing/kustomization.yml deleted file mode 100644 index 56ee77e..0000000 --- a/backend/deployment/overlays/testing/kustomization.yml +++ /dev/null @@ -1,27 +0,0 @@ -namespace: mycowgame-com-backend-testing - -bases: - - ../../base - -configMapGenerator: -- name: mycowgame-com-backend - env: config.properties - -resources: - - namespace.yml - -images: -- name: ghcr.io/jnewb1/mycowgame.com/backend - newName: ghcr.io/jnewb1/mycowgame.com/backend/main - -patches: - - target: - kind: Ingress - name: mycowgame-com-backend - patch: |- - - op: replace - path: /spec/rules/0/host - value: api.testing.mycowgame.com - - op: replace - path: /spec/tls/0/hosts/0 - value: api.testing.mycowgame.com \ No newline at end of file diff --git a/backend/deployment/overlays/testing/namespace.yml b/backend/deployment/overlays/testing/namespace.yml deleted file mode 100644 index 02cf259..0000000 --- a/backend/deployment/overlays/testing/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: mycowgame-com-backend-testing \ No newline at end of file diff --git a/frontend/deployment/base/kustomization.yaml b/frontend/deployment/base/kustomization.yaml deleted file mode 100644 index 81ac427..0000000 --- a/frontend/deployment/base/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -configMapGenerator: -- name: cicd - envs: [cicd.env] - -resources: - - deployment.yml \ No newline at end of file diff --git a/frontend/deployment/base/deployment.yml b/frontend/deployment/deployment.yml similarity index 100% rename from frontend/deployment/base/deployment.yml rename to frontend/deployment/deployment.yml diff --git a/frontend/deployment/kustomization.yaml b/frontend/deployment/kustomization.yaml new file mode 100644 index 0000000..48851ad --- /dev/null +++ b/frontend/deployment/kustomization.yaml @@ -0,0 +1,6 @@ +configMapGenerator: +- name: mycowgame-com-frontend + env: config.properties + +resources: + - deployment.yml \ No newline at end of file diff --git a/frontend/deployment/overlays/production/config.properties b/frontend/deployment/overlays/production/config.properties deleted file mode 100644 index 59e5274..0000000 --- a/frontend/deployment/overlays/production/config.properties +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://api.mycowgame.com \ No newline at end of file diff --git a/frontend/deployment/overlays/production/kustomization.yml b/frontend/deployment/overlays/production/kustomization.yml deleted file mode 100644 index a4f85e3..0000000 --- a/frontend/deployment/overlays/production/kustomization.yml +++ /dev/null @@ -1,27 +0,0 @@ -namespace: mycowgame-com-frontend-production - -bases: - - ../../base - -configMapGenerator: -- name: mycowgame-com-frontend - env: config.properties - -resources: - - namespace.yml - -images: -- name: ghcr.io/jnewb1/mycowgame.com/frontend - newName: ghcr.io/jnewb1/mycowgame.com/frontend/main - -patches: - - target: - kind: Ingress - name: mycowgame-com-frontend - patch: |- - - op: replace - path: /spec/rules/0/host - value: mycowgame.com - - op: replace - path: /spec/tls/0/hosts/0 - value: mycowgame.com \ No newline at end of file diff --git a/frontend/deployment/overlays/production/namespace.yml b/frontend/deployment/overlays/production/namespace.yml deleted file mode 100644 index 4dbce5f..0000000 --- a/frontend/deployment/overlays/production/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: mycowgame-com-frontend-production \ No newline at end of file diff --git a/frontend/deployment/overlays/staging/config.properties b/frontend/deployment/overlays/staging/config.properties deleted file mode 100644 index e2bff7d..0000000 --- a/frontend/deployment/overlays/staging/config.properties +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://api.staging.mycowgame.com \ No newline at end of file diff --git a/frontend/deployment/overlays/staging/kustomization.yml b/frontend/deployment/overlays/staging/kustomization.yml deleted file mode 100644 index 178a45e..0000000 --- a/frontend/deployment/overlays/staging/kustomization.yml +++ /dev/null @@ -1,27 +0,0 @@ -namespace: mycowgame-com-frontend-staging - -bases: - - ../../base - -configMapGenerator: -- name: mycowgame-com-frontend - env: config.properties - -resources: - - namespace.yml - -images: -- name: ghcr.io/jnewb1/mycowgame.com/frontend - newName: ghcr.io/jnewb1/mycowgame.com/frontend/staging - -patches: - - target: - kind: Ingress - name: mycowgame-com-frontend - patch: |- - - op: replace - path: /spec/rules/0/host - value: staging.mycowgame.com - - op: replace - path: /spec/tls/0/hosts/0 - value: staging.mycowgame.com \ No newline at end of file diff --git a/frontend/deployment/overlays/staging/namespace.yml b/frontend/deployment/overlays/staging/namespace.yml deleted file mode 100644 index 015f457..0000000 --- a/frontend/deployment/overlays/staging/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: mycowgame-com-frontend-staging \ No newline at end of file diff --git a/frontend/deployment/overlays/testing/config.properties b/frontend/deployment/overlays/testing/config.properties deleted file mode 100644 index 26cdf9a..0000000 --- a/frontend/deployment/overlays/testing/config.properties +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://api.testing.mycowgame.com \ No newline at end of file diff --git a/frontend/deployment/overlays/testing/kustomization.yml b/frontend/deployment/overlays/testing/kustomization.yml deleted file mode 100644 index 328ed66..0000000 --- a/frontend/deployment/overlays/testing/kustomization.yml +++ /dev/null @@ -1,27 +0,0 @@ -namespace: mycowgame-com-frontend-testing - -bases: - - ../../base - -configMapGenerator: -- name: mycowgame-com-frontend - env: config.properties - -resources: - - namespace.yml - -images: -- name: ghcr.io/jnewb1/mycowgame.com/frontend - newName: ghcr.io/jnewb1/mycowgame.com/frontend/develop - -patches: - - target: - kind: Ingress - name: mycowgame-com-frontend - patch: |- - - op: replace - path: /spec/rules/0/host - value: testing.mycowgame.com - - op: replace - path: /spec/tls/0/hosts/0 - value: testing.mycowgame.com \ No newline at end of file diff --git a/frontend/deployment/overlays/testing/namespace.yml b/frontend/deployment/overlays/testing/namespace.yml deleted file mode 100644 index 6ea1d51..0000000 --- a/frontend/deployment/overlays/testing/namespace.yml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: mycowgame-com-frontend-testing \ No newline at end of file