Skip to content

Update the flow for github CD #10

Update the flow for github CD

Update the flow for github CD #10

Workflow file for this run

name: Docker Image CI for GHCR for Bridge Server
on:
push:
branches:
- main
paths:
- "server/**" # Only trigger the workflow for changes in the server directory
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: |
corepack enable
pnpm install
working-directory: server
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
run: |
docker login --username zeekay --password "${{ secrets.GITHUB_TOKEN}}" ghcr.io
- name: Run Docker build and push with pnpm script
run: |
pnpm docker:build && pnpm docker:push
working-directory: server
deploy:
needs: build_and_publish
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.30.6 # Or specify the appropriate version
- name: Deploy to Kubernetes
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} # Add KUBE_CONFIG to your GitHub secrets
run: |
pnpm k8s:apply
working-directory: server