Skip to main content

Tag Trigger Workflow (tag-trigger.yaml)

The Tag Trigger Workflow automates production deployments when version tags are pushed to the repository. It triggers the Docker build process for all services and creates draft GitHub releases for manual review and publication.

🚀 Overview

  • File: .github/workflows/tag-trigger.yaml
  • Purpose: Production deployment automation
  • Trigger: Version tags (v* pattern)
  • Features: Docker image building, draft release creation
  • Environment: Production environment deployment

🔄 Trigger Events

on:
push:
tags:
- 'v*'

Tag Pattern Matching

The workflow triggers on tags matching the v* pattern:

  • v1.0.0 - Standard semantic version
  • v2.3.1 - Patch release
  • v1.0.0-beta.1 - Pre-release version
  • v3.2.1-hotfix - Hotfix release
  • release-1.0.0 - Doesn't match pattern
  • 1.0.0 - Missing 'v' prefix

🏗️ Workflow Jobs

1. Docker Image Building

call-build-docker:
uses: ./.github/workflows/build.docker.yaml
with:
env: production
tag: ${{ github.ref_name }}
secrets: inherit

Process:

  • Calls the reusable Docker build workflow
  • Sets environment to production
  • Uses the git tag name as the image tag
  • Inherits all repository secrets

2. Draft Release Creation

create-draft-release:
needs: call-build-docker
runs-on: ubuntu-latest
steps:
- name: Create Draft Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: true
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

🐳 Production Docker Deployment

Image Building Process

When a tag is created, the workflow:

  1. Triggers Build: Calls build.docker.yaml with production settings
  2. Builds All Services: Creates production images for all 12 microservices
  3. Tags Images: Uses the git tag as the Docker image tag
  4. Pushes to Registry: Uploads to Google Cloud Registry

Production Image Naming

gcr.io/dash-208313/dashclicks-production-[service]:[tag]

Examples:

  • gcr.io/dash-208313/dashclicks-production-api-internal:v1.2.3
  • gcr.io/dash-208313/dashclicks-production-socket-conversation:v1.2.3
  • gcr.io/dash-208313/dashclicks-production-queue-manager-general:v1.2.3

Service Matrix

All 12 services get production images:

Service CategoryServices
Core APIsapi-internal, api-external, api-ai
Gatewaydashboard-gateway
Communicationsocket-conversation, socket-general
Processingqueue-manager-general, queue-manager-puppeteer
Utilitiesnotifications, callrail-proxy, currency-converter, misc-proxy

📋 Draft Release Creation

Release Configuration

tag_name: ${{ github.ref_name }} # Uses the pushed tag
name: Release ${{ github.ref_name }} # Release title
draft: true # Creates as draft
prerelease: false # Not marked as pre-release
generate_release_notes: true # Auto-generates notes

Auto-Generated Release Notes

GitHub automatically generates release notes including:

  • Pull requests: All PRs merged since last release
  • Contributors: Users who contributed changes
  • Commit highlights: Significant changes and features
  • Breaking changes: If detected in commit messages

Draft Status Benefits

Why drafts?

  • Manual review: Team can review before publication
  • Content editing: Ability to customize release notes
  • Timing control: Publish when ready, not automatically
  • Quality assurance: Final check before public release

🔒 Security & Permissions

Required Secrets

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatic token for releases

Plus all secrets inherited from build.docker.yaml:

GKE_SA_KEY: Google Cloud service account key
GKE_PROJECT: Google Cloud project ID
PACKAGE_TOKEN: GitHub Packages authentication

Permission Requirements

GitHub Token Permissions:

  • Contents: Write access for release creation
  • Metadata: Read access for repository information
  • Actions: Read access for workflow context

Service Account Permissions:

  • Container Registry: Push access for production images
  • Cloud Storage: Access for registry backend

🔄 Deployment Flow

Complete Release Process

1. Tag Creation
├── Developer creates version tag: git tag v1.2.3
└── Push tag: git push origin v1.2.3

2. Workflow Trigger
├── Tag trigger workflow starts
└── Docker build workflow called

3. Image Building
├── Build all 12 production services
├── Tag with version number
└── Push to Google Cloud Registry

4. Draft Release
├── Create GitHub draft release
├── Generate release notes
└── Wait for manual publication

5. Manual Steps
├── Review draft release
├── Edit release notes if needed
└── Publish release

Deployment Verification

After workflow completion, verify:

# Check Docker images in GCR
gcloud container images list-tags gcr.io/dash-208313/dashclicks-production-api-internal

# Verify all services have the new tag
for service in api-internal api-external dashboard-gateway; do
gcloud container images list-tags gcr.io/dash-208313/dashclicks-production-$service --filter="tags:v1.2.3"
done

📊 Monitoring & Tracking

Workflow Status

Monitor deployment progress:

  • Build Status: Docker image building for all services
  • Registry Status: Image push completion
  • Release Status: Draft release creation
  • Error Tracking: Failure points and resolution

Deployment Metrics

Track key metrics:

  • Build Time: Total time for all service builds
  • Image Sizes: Production image size optimization
  • Success Rate: Deployment success percentage
  • Rollback Frequency: Need for version rollbacks

🛠️ Usage Examples

Standard Release

# Create and push semantic version tag
git tag v1.2.3
git push origin v1.2.3

# Expected outcome:
# - Production images built for all services
# - Draft release created with auto-generated notes
# - Ready for manual publication

Hotfix Release

# Create hotfix tag
git tag v1.2.4-hotfix
git push origin v1.2.4-hotfix

# Expected outcome:
# - Emergency production deployment
# - Hotfix images available immediately
# - Draft release for documentation

Pre-release Version

# Create beta/rc tag
git tag v2.0.0-beta.1
git push origin v2.0.0-beta.1

# Workflow will:
# - Build production images (suitable for staging)
# - Create draft release
# - Maintain version history

📋 Tag Configuration Requirements

Supported Tag Patterns

The workflow accepts tags matching the v* pattern:

  • Pattern: v[version] where version can include numbers, dots, hyphens
  • Examples: v1.0.0, v2.3.1-beta.1, v1.0.0-hotfix
  • Exclusions: Tags not starting with 'v' are ignored

Draft Release Settings

  • Draft Status: All releases created as drafts requiring manual publication
  • Auto-generation: Release notes automatically generated from merged PRs
  • Prerelease Flag: Set to false by default
  • Token Requirement: Uses GITHUB_TOKEN with contents write permission

Dependencies

  • Docker Build: Requires successful completion of build.docker.yaml
  • Registry Access: Requires valid GKE_SA_KEY for Google Cloud Registry
  • GitHub Token: Requires GITHUB_TOKEN with release creation permissions

💬

Documentation Assistant

Ask me anything about the docs

Hi! I'm your documentation assistant. Ask me anything about the docs!

I can help you with:
- Code examples
- Configuration details
- Troubleshooting
- Best practices

Try asking: How do I configure the API?
09:31 AM