Skip to content

Implemented a deployment script "deploy.sh" to automate the deploymen… #40

Implemented a deployment script "deploy.sh" to automate the deploymen…

Implemented a deployment script "deploy.sh" to automate the deploymen… #40

Workflow file for this run

name: Build, Test, and Deploy
on:
push:
paths:
- "grafana/**"
- ".github/workflows/workflow.yml"
pull_request:
paths:
- "grafana/**"
- ".github/workflows/workflow.yml"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Validate docker-compose.yml
run: |
cd grafana
docker compose config
- name: Build Docker images
run: |
cd grafana
docker compose pull
docker compose build
- name: Start services
run: |
cd grafana
docker compose up -d
- name: Wait for Grafana to be ready
run: |
timeout 60 bash -c 'until curl -f http://localhost:3000/api/health; do sleep 2; done'
- name: Check Grafana health
run: |
curl -f http://localhost:3000/api/health
- name: Stop services
if: always()
run: |
cd grafana
docker compose down -v
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Deploy dashboards to Grafana Cloud
env:
GRAFANA_URL: https://softwarecsc65.grafana.net
GRAFANA_TOKEN: ${{ secrets.GRAFANA_SERVICE_ACCOUNT_TOKEN }}
run: bash grafana/scripts/deploy.sh