Skip to content

Merge pull request #242 from Flux159/pr242 #72

Merge pull request #242 from Flux159/pr242

Merge pull request #242 from Flux159/pr242 #72

Workflow file for this run

name: cd
on:
push:
tags:
- v*
permissions:
id-token: write
contents: write
packages: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Set up Helm
uses: azure/[email protected]
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Minikube
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=docker
minikube status
- name: Start kubectl proxy
run: |
# Start the proxy in background and save the PID
kubectl proxy --port=8080 &
echo "KUBECTL_PROXY_PID=$!" >> $GITHUB_ENV
# Give the proxy a moment to start
sleep 3
# Update the kubeconfig file to use the proxy URL
sed -i 's|https://192.168.49.2:8443|http://localhost:8080|g' ~/.kube/config
# Verify the change took effect
grep "server:" ~/.kube/config
- name: Run Tests in Minikube
run: bun run test
- name: Clean up kubectl proxy
if: always()
run: |
if [ -n "$KUBECTL_PROXY_PID" ]; then
echo "Stopping kubectl proxy (PID: $KUBECTL_PROXY_PID)"
kill $KUBECTL_PROXY_PID || true
fi
# Restore the original kubeconfig (optional)
sed -i 's|http://localhost:8080|https://192.168.49.2:8443|g' ~/.kube/config
- name: Update version number
uses: reecetech/[email protected]
id: version
with:
scheme: semver
increment: patch
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit the new version
run: |
# Make sure we're on main branch
git checkout main
# Update the version in all files using the npm script
npm run version:update ${{ steps.version.outputs.current-version }}
git add package.json manifest.json CITATION.cff README.md
git commit -m "Bump version to ${{ steps.version.outputs.current-version }}"
# Create and push the tag
git tag ${{ steps.version.outputs.current-version }}
# Push both the commit and the tag
git push origin main
git push origin ${{ steps.version.outputs.current-version }}
- name: Build For production
run: bun run build
- name: Setup Node.js for NPM publish
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Update npm for OIDC support
run: npm install -g npm@latest
- name: Publish to NPM
env:
NPM_CONFIG_PROVENANCE: true
run: npm publish --provenance
- name: Update, Package and Push Helm chart to GHCR
run: |
yq e -i '.version = "${{ steps.version.outputs.current-version }}"' ./helm-chart/Chart.yaml
yq e -i '.appVersion = "${{ steps.version.outputs.current-version }}"' ./helm-chart/Chart.yaml
# Package the chart and push it to GitHub Packages (ghcr.io).
helm package ./helm-chart
# OCI registries require lowercase names
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
helm push *.tgz oci://ghcr.io/${REPO_OWNER}
- name: Build dxt
run: |
bun run buildmcpb
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload v${{ steps.version.outputs.current-version }} mcp-server-kubernetes.mcpb --clobber
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: flux159/${{ github.event.repository.name }}:latest,flux159/${{ github.event.repository.name }}:v${{ steps.version.outputs.current-version }}