Bump version to 1.2.0 #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Internet Connection Monitor CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'nborgers/**' | |
| paths: | |
| - 'internet-connection-monitor/**' | |
| - '.github/workflows/internet-connection-monitor-ci.yml' | |
| pull_request: | |
| paths: | |
| - 'internet-connection-monitor/**' | |
| - '.github/workflows/internet-connection-monitor-ci.yml' | |
| release: | |
| types: [published] | |
| jobs: | |
| # Only run if the release tag matches this component OR if it's not a release event | |
| check-component: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-run: ${{ steps.check.outputs.should-run }} | |
| is-release: ${{ steps.check.outputs.is-release }} | |
| steps: | |
| - name: Check if workflow should run | |
| id: check | |
| run: | | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| TAG_NAME="${{ github.event.release.tag_name }}" | |
| if [[ "$TAG_NAME" == internet-connection-monitor-v* ]]; then | |
| echo "should-run=true" >> $GITHUB_OUTPUT | |
| echo "is-release=true" >> $GITHUB_OUTPUT | |
| echo "✅ Release tag matches component: $TAG_NAME" | |
| else | |
| echo "should-run=false" >> $GITHUB_OUTPUT | |
| echo "is-release=false" >> $GITHUB_OUTPUT | |
| echo "⏭️ Skipping - release tag doesn't match component: $TAG_NAME" | |
| fi | |
| else | |
| echo "should-run=true" >> $GITHUB_OUTPUT | |
| echo "is-release=false" >> $GITHUB_OUTPUT | |
| echo "✅ Running for push/PR event" | |
| fi | |
| integration-test: | |
| needs: check-component | |
| if: needs.check-component.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: internet-connection-monitor | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| docker build -t internet-connection-monitor:latest . | |
| - name: Run integration tests | |
| run: | | |
| chmod +x test-integration.sh | |
| ./test-integration.sh | |
| - name: Show logs on failure | |
| if: failure() | |
| run: | | |
| echo "=== Docker Compose Status ===" | |
| cd deployments | |
| docker compose -f docker-compose.with-stack.yml ps | |
| echo "=== Monitor Logs ===" | |
| docker logs internet-monitor 2>&1 | tail -50 || true | |
| echo "=== Elasticsearch Logs ===" | |
| docker logs elasticsearch 2>&1 | tail -50 || true | |
| echo "=== Grafana Logs ===" | |
| docker logs grafana 2>&1 | tail -50 || true | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| cd deployments | |
| docker compose -f docker-compose.with-stack.yml down -v || true | |
| publish-image: | |
| needs: [check-component, integration-test] | |
| if: needs.check-component.outputs.is-release == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| defaults: | |
| run: | |
| working-directory: internet-connection-monitor | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| TAG_NAME="${{ github.event.release.tag_name }}" | |
| VERSION="${TAG_NAME#internet-connection-monitor-v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Set lowercase repository owner | |
| id: repo_owner | |
| run: | | |
| echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./internet-connection-monitor | |
| push: true | |
| tags: | | |
| ghcr.io/${{ steps.repo_owner.outputs.owner }}/internet-connection-monitor:latest | |
| ghcr.io/${{ steps.repo_owner.outputs.owner }}/internet-connection-monitor:${{ steps.version.outputs.version }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |