Skip to content

change name

change name #18

Workflow file for this run

name: CI/CD Chicmoz Prod
# TODO
on:
push:
branches:
- "devops/create-develop-skaffold"
pull_request:
branches:
- production
types:
- closed
jobs:
build_and_deploy:
runs-on:
labels: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
sudo install skaffold /usr/local/bin/
shell: bash
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 1800
- name: Cleanup old images
run: |
chmod +x ".github/workflows/cleanup-script.sh"
bash -x ".github/workflows/cleanup-script.sh"
- name: Build and Push Images
run: |
MAX_RETRIES=3
RETRY_DELAY=10
build_and_push() {
for i in $(seq 1 $MAX_RETRIES); do
if skaffold build --filename "k8s/production/skaffold.production.yaml"; then
return 0
fi
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
sleep $RETRY_DELAY
done
return 1
}
if build_and_push; then
echo "Build and push successful"
else
echo "Build and push failed after $MAX_RETRIES attempts"
exit 1
fi
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save "chicmoz-prod"
- name: Deploy to cluster with Skaffold
run: |
MAX_RETRIES=3
RETRY_DELAY=10
for i in $(seq 1 $MAX_RETRIES); do
if skaffold run --filename "k8s/production/skaffold.production.yaml"; then
echo "Deployment successful"
exit 0
fi
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
sleep $RETRY_DELAY
done
echo "Deployment failed after $MAX_RETRIES attempts"
exit 1