-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76ae864
commit ddae6e8
Showing
3 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Dev Build & Deploy | ||
|
||
on: | ||
push: | ||
branches: [dev] | ||
paths: | ||
- 'client/**' | ||
- 'backend/**' | ||
|
||
jobs: | ||
client: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.head_commit.message, '[client]') | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: set version | ||
run: echo "TAG_VERSION=dev.$(date +'%y-%m-%d').$GITHUB_RUN_NUMBER" >> $GITHUB_ENV | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push client | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./client | ||
file: ./client/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
sayinmehmet47/client-kitapkurdu-1:dev | ||
sayinmehmet47/client-kitapkurdu-1:${{ env.TAG_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 | ||
set image deployment/client-deployment client=sayinmehmet47/client-kitapkurdu-1:${{ env.TAG_VERSION }} | ||
env: | ||
KUBECONFIG: kubeconfig | ||
|
||
backend: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.head_commit.message, '[backend]') | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: set version | ||
run: echo "TAG_VERSION=dev.$(date +'%y-%m-%d').$GITHUB_RUN_NUMBER" >> $GITHUB_ENV | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push backend | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./backend | ||
file: ./backend/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
sayinmehmet47/backend-kitapkurdu-1:dev | ||
sayinmehmet47/backend-kitapkurdu-1:${{ env.TAG_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 backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters