Skip to content

chore: change the config #23

chore: change the config

chore: change the config #23

Workflow file for this run

name: cd
on:
push:
branches:
- main
concurrency:
group: cd
cancel-in-progress: true
jobs:
deploy_api_server:
name: Push Docker image to Docker Hub, Deploy API Server.
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name }}
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "::set-output name=short_sha::$calculatedSha"
- name: Confirm git commit SHA output
run: echo ${{ steps.vars.outputs.short_sha }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/api-server:${{ steps.vars.outputs.short_sha }}
- name: Deploy to K8S
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: kubectl -n ${{ secrets.NAMESPACE }} set image deploy/api-server api-server=${{ secrets.DOCKERHUB_USERNAME }}/api-server:${{ steps.vars.outputs.short_sha }}