feat: message display #15
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: Build and Push Python Client Image | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| concurrency: | |
| group: build-python-client | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-22.04-arm | |
| steps: | |
| - name: Record job start time | |
| run: echo "JOB_START_MS=$(date +%s%3N)" >> "$GITHUB_ENV" | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Log in to private Docker registry | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login docker.kmanning.ie:5000 -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Build and push Docker image | |
| run: | | |
| IMAGE=docker.kmanning.ie:5000/intercom-python-client | |
| APP_VERSION=$(cat VERSION) | |
| DOCKER_TAG=$(echo "$APP_VERSION" | tr '+' '-') | |
| docker build \ | |
| --build-arg APP_VERSION="$APP_VERSION" \ | |
| -f Dockerfile \ | |
| -t "$IMAGE:latest" \ | |
| -t "$IMAGE:${{ github.sha }}" \ | |
| -t "$IMAGE:$DOCKER_TAG" \ | |
| . | |
| docker push "$IMAGE:latest" | |
| docker push "$IMAGE:${{ github.sha }}" | |
| docker push "$IMAGE:$DOCKER_TAG" | |
| - name: Send CI metrics to Honeycomb | |
| if: always() | |
| env: | |
| HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }} | |
| JOB_STATUS: ${{ job.status }} | |
| run: | | |
| END_MS=$(date +%s%3N) | |
| DURATION_MS=$((END_MS - JOB_START_MS)) | |
| COMMIT_MSG=$(git log -1 --pretty=format:%s 2>/dev/null || echo "") | |
| curl -s -X POST "https://api.honeycomb.io/1/events/github-actions" \ | |
| -H "X-Honeycomb-Team: $HONEYCOMB_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-Honeycomb-Event-Time: $(date -u +%Y-%m-%dT%H:%M:%SZ)" \ | |
| -d "$(jq -cn \ | |
| --arg workflow "$GITHUB_WORKFLOW" \ | |
| --arg job "$GITHUB_JOB" \ | |
| --arg status "$JOB_STATUS" \ | |
| --argjson duration_ms "$DURATION_MS" \ | |
| --arg sha "$GITHUB_SHA" \ | |
| --arg ref "$GITHUB_REF_NAME" \ | |
| --arg actor "$GITHUB_ACTOR" \ | |
| --arg repository "$GITHUB_REPOSITORY" \ | |
| --argjson run_id "$GITHUB_RUN_ID" \ | |
| --argjson run_number "$GITHUB_RUN_NUMBER" \ | |
| --arg commit_message "$COMMIT_MSG" \ | |
| '{workflow: $workflow, job: $job, status: $status, duration_ms: $duration_ms, | |
| sha: $sha, ref: $ref, actor: $actor, repository: $repository, | |
| run_id: $run_id, run_number: $run_number, commit_message: $commit_message}')" || true |