This directory contains the GitHub Actions workflows and scripts for automated testing, building, and deployment of the SC Metrics Agent.
Triggers: Pull requests to main branch
Actions:
- Run unit tests
- Perform linting with golangci-lint
- Build binary to verify compilation
- Run security scans with Gosec
Triggers: Push to main branch
Actions:
- Auto-generate beta version (e.g.,
0.1.0-beta.1) - Build and package Debian package
- Deploy to beta APT repository
- Create GitHub pre-release
- Generate commit-based changelog
Triggers: Manual workflow dispatch
Actions:
- Validate semantic version input
- Build and package Debian package
- Deploy to stable APT repository
- Create GitHub release
- Generate comprehensive changelog
- Format:
X.Y.Z-beta.N(e.g.,0.1.0-beta.1) - Generation: Automatic based on last release
- Increment: Beta number increases for each push to main
- Format:
X.Y.Z(e.g.,0.1.0) - Generation: Manual input via workflow dispatch
- Types: major, minor, patch (validated against last stable)
The CI/CD pipeline uses your existing setup_repo.sh script for deployment:
- Repository:
https://repo.cloud.strettch.com/metrics/ - Install:
curl -sSL https://repo.cloud.strettch.com/metrics/install.sh | sudo bash - Both beta and stable releases use the same repository
The following GitHub secrets must be configured:
REPO_SSH_KEY: Base64-encoded SSH private key for repository server accessREPO_HOST: Repository server hostnameREPO_USER: Username for repository server access
The repository server must have the following setup:
Configure GPG agent for batch mode automation:
# Create or update GPG agent config
mkdir -p /root/.gnupg
cat > /root/.gnupg/gpg-agent.conf << EOF
allow-loopback-pinentry
pinentry-program /usr/bin/pinentry-tty
default-cache-ttl 3600
max-cache-ttl 3600
EOF
# Restart GPG agent
gpg-connect-agent reloadagent /byeCreate passphrase file for existing GPG key:
echo "your_gpg_passphrase" > /root/gpg-passphrase.txt
chmod 600 /root/gpg-passphrase.txtCreate a GPG key without passphrase for automation:
gpg --batch --gen-key <<EOF
Key-Type: RSA
Key-Length: 2048
Name-Real: Engineering Team
Name-Email: engineering@strettch.com
Expire-Date: 0
%no-protection
%commit
EOFcd /root/sc-metrics-agent
# The existing setup_repo.sh script must be present hereAll dependencies for setup_repo.sh (aptly, gpg, caddy, etc.)
Generates appropriate version numbers for beta releases based on Git tags.
Creates changelogs for releases:
- Beta: Commits since last beta/stable
- Stable: Comprehensive changelog since last stable
Simplified deployment script:
- Uploads package to repository server at
/root/sc-metrics-agent/ - Runs your existing
./setup_repo.shscript - Uses the same workflow you're familiar with
- Push changes to
mainbranch - GitHub Actions automatically creates beta release
- Version is auto-generated (e.g.,
0.1.0-beta.1) - Package deployed to beta repository
- Go to GitHub Actions
- Run "Stable Release" workflow
- Input desired version (e.g.,
0.1.0) - Select release type (major/minor/patch)
- Package deployed to stable repository
- Create pull request to
mainbranch - GitHub Actions automatically runs tests and builds
- Review results before merging
PR → Tests/Lint/Build → Merge to main → Beta Release → Manual Stable Release
Each step ensures code quality and provides automated deployment to appropriate repositories.