diff --git a/.github/workflows/deploy-staging-backend.yaml b/.github/workflows/deploy-staging-backend.yaml new file mode 100644 index 00000000..b3c934b5 --- /dev/null +++ b/.github/workflows/deploy-staging-backend.yaml @@ -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 diff --git a/.github/workflows/deploy-staging-client.yaml b/.github/workflows/deploy-staging-client.yaml new file mode 100644 index 00000000..1f3b4ced --- /dev/null +++ b/.github/workflows/deploy-staging-client.yaml @@ -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