Merge pull request #210 from sayinmehmet47/cookie-based-auth #114
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
name: deploy-backend | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'backend/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- run: cd backend | |
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
# - run: docker push sayinmehmet47/backend-kitapkurdu-1 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: backend/ | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: sayinmehmet47/backend-kitapkurdu-1 | |
- name: Install kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x kubectl | |
sudo mv kubectl /usr/local/bin/ | |
- name: Create .kube directory | |
run: mkdir -p $HOME/.kube | |
- name: Create .kube/config | |
run: | | |
cat <<EOF > $HOME/.kube/config | |
apiVersion: v1 | |
kind: Config | |
clusters: | |
- name: rancher | |
cluster: | |
server: "https://rancher.riwi.dev/k8s/clusters/c-m-cp898j4l" | |
users: | |
- name: rancher | |
user: | |
token: ${{ secrets.KUBE_CONFIG_TOKEN }} | |
contexts: | |
- name: rancher | |
context: | |
user: rancher | |
cluster: rancher | |
namespace: kitapkurdu | |
current-context: rancher | |
EOF | |
- name: Deploy using kubectl | |
run: kubectl rollout restart deployment/backend-deployment -n kitapkurdu |