36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
name: Build and Deploy
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Login to Registry
|
|
# run: echo "${{ secrets.GITEA_TOKEN }}" | docker login 192.168.x.x --username ${{ github.actor }} --password-stdin
|
|
run: echo "${{ secrets.GITEA_TOKEN }}" | docker login git.chopark.home --username ${{ github.actor }} --password-stdin
|
|
|
|
- name: Build and Push
|
|
run: |
|
|
# docker build -t 192.168.x.x/${{ github.repository }}:latest .
|
|
# docker push 192.168.x.x/${{ github.repository }}:latest
|
|
docker build -t git.chopark.home/${{ github.repository }}:latest .
|
|
docker push git.chopark.home/${{ github.repository }}:latest
|
|
|
|
deploy-to-k8s:
|
|
needs: build-and-push
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set Kubeconfig
|
|
run: echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig.yaml
|
|
|
|
- name: Update Deployment
|
|
run: |
|
|
export KUBECONFIG=kubeconfig.yaml
|
|
# kubectl set image deployment/my-app my-app=192.168.x.x/${{ github.repository }}:latest
|
|
kubectl set image deployment/catalog26-deployment catalog26-deployment=git.chopark.home/${{ github.repository }}:latest
|