Skip to content

Commit

Permalink
Update function to handle edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sayinmehmet47 committed May 7, 2024
1 parent 1b2ed77 commit f0743fa
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/deploy-staging-backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Promote to Backend Staging

on:
workflow_dispatch:
inputs:
version:
description: 'Version to promote'
required: true

jobs:
promote:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Pull dev image
uses: docker/build-push-action@v2
with:
context: ./backend
push: false
tags: sayinmehmet47/backend-kitapkurdu-1:${{ github.event.inputs.version }}
load: true

- name: Retag image for staging
run: docker tag sayinmehmet47/backend-kitapkurdu-1:${{ github.event.inputs.version }} sayinmehmet47/backend-kitapkurdu-1:staging.${{ github.event.inputs.version }}

- name: Push staging image
uses: docker/build-push-action@v2
with:
context: ./backend
push: true
tags: sayinmehmet47/backend-kitapkurdu-1:staging.${{ github.event.inputs.version }}

- name: Deploy to Kubernetes
run: |
kubectl config set-cluster kubernetes --server="https://rancher.riwi.dev/k8s/clusters/c-m-cp898j4l"
kubectl config set-credentials github-action --token=${{ secrets.KUBE_CONFIG_TOKEN }}
kubectl config set-context default --cluster=kubernetes --user=github-action
kubectl config use-context default
kubectl set image deployment/backend-deployment-dev backend=sayinmehmet47/backend-kitapkurdu-1:staging.${{ github.event.inputs.version }} -n kitapkurdu
env:
KUBECONFIG: kubeconfig
52 changes: 52 additions & 0 deletions .github/workflows/deploy-staging-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Promote to Client Staging

on:
workflow_dispatch:
inputs:
version:
description: 'Version to promote'
required: true

jobs:
promote:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Pull dev image
uses: docker/build-push-action@v2
with:
context: .
push: false
tags: sayinmehmet47/client-kitapkurdu-1:${{ github.event.inputs.version }}
load: true

- name: Retag image for staging
run: docker tag sayinmehmet47/client-kitapkurdu-1:${{ github.event.inputs.version }} sayinmehmet47/client-kitapkurdu-1:staging.${{ github.event.inputs.version }}

- name: Push staging image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: sayinmehmet47/client-kitapkurdu-1:staging.${{ github.event.inputs.version }}

- name: Deploy to Kubernetes
run: |
kubectl config set-cluster kubernetes --server="https://rancher.riwi.dev/k8s/clusters/c-m-cp898j4l"
kubectl config set-credentials github-action --token=${{ secrets.KUBE_CONFIG_TOKEN }}
kubectl config set-context default --cluster=kubernetes --user=github-action
kubectl config use-context default
kubectl set image deployment/frontend-deployment-dev frontend=sayinmehmet47/client-kitapkurdu-1:staging.${{ github.event.inputs.version }} -n kitapkurdu
env:
KUBECONFIG: kubeconfig

0 comments on commit f0743fa

Please sign in to comment.