Quickfix #8
Workflow file for this run
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: Continous Deployment | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and push Docker image | |
runs-on: k8s-runners | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: bl4ko/homepage:latest | |
deploy: | |
name: Deploy application to server | |
runs-on: k8s-runners | |
needs: build | |
steps: | |
- name: Add key from variable | |
run: | | |
echo "${{ secrets.DEPLOY_KEY }}" > ./key && chmod 600 ./key | |
- name: Install ssh client if not installed | |
run: | | |
sudo apt-get update && sudo apt-get install openssh-client -y | |
- name: Connect to host and update | |
run: | | |
ssh -o StrictHostKeyChecking=no -i ./key -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} '~/.local/bin/kubectl rollout restart deployment/portfolio -n portfolio' |