Files
blog/.gitea/workflows/ci.yaml
kuwoyuki 3b0661dfe8
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m56s
chore: zz
2025-02-07 01:15:51 +06:00

62 lines
1.6 KiB
YAML

name: Build and Deploy
on:
push:
branches: [master]
jobs:
build-and-push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Docker login
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ vars.REGISTRY_URL }}/${{ steps.meta.outputs.REPO_NAME }}:${{ github.sha }}
${{ vars.REGISTRY_URL }}/${{ steps.meta.outputs.REPO_NAME }}:latest
# - name: Deploy to cluster
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# with:
# args: get pods
- name: Set up kubectl
uses: azure/setup-kubectl@v3
- name: Deploy to cluster
env:
KUBECONFIG: /tmp/kubeconfig.yaml
shell: bash
run: |
echo "Shell: $SHELL"
echo "Current env:"
env
mkdir -p /tmp
echo "${{ secrets.KUBE_CONFIG }}" > $KUBECONFIG
ls -l $KUBECONFIG
kubectl version --client
kubectl apply -f manifests/