feat: mod svc name #8
Workflow file for this run
This file contains hidden or 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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- feat/front-docker-deploy | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: frontend | |
file: frontend/zicdding-class.com/Dockerfile | |
tags: ${{ secrets.DOCKER_USERNAME }}/zicdding-front:latest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Kubeconfig | |
run: | | |
mkdir -p $HOME/.kube | |
echo "${{ secrets.KUBECONFIG }}" | base64 --decode > $HOME/.kube/config | |
- name: Install ArgoCD CLI | |
run: | | |
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 | |
chmod +x /usr/local/bin/argocd | |
- name: Deploy to ArgoCD | |
run: | | |
argocd login ${{ secrets.ARGOCD_SERVER }} --username ${{ secrets.ARGOCD_USERNAME }} --password ${{ secrets.ARGOCD_PASSWORD }} --insecure | |
argocd app create example-app \ | |
--repo https://github.com/Zicdding/zicdding-class.git \ | |
--path frontend/zicdding-class.com/k8s/manifests \ | |
--dest-server https://kubernetes.default.svc \ | |
--dest-namespace default \ | |
--sync-policy automated | |
argocd app sync example-app |