This document explains the GitHub Actions workflows that have been set up for Slaking to automatically build, test, and deploy the container image and Helm chart.
The repository includes three GitHub Actions workflows:
- Container Deployment (
deploy-container.yml) - Builds and pushes Docker images to GitHub Container Registry - Helm Chart Publishing (
publish-helm.yml) - Publishes Helm charts to GitHub Pages - GitHub Pages Setup (
setup-pages.yml) - Initial setup for GitHub Pages hosting
File: .github/workflows/deploy-container.yml
Triggers:
- Push to
mainordevelopbranches (when source code changes) - Pull requests to
mainbranch - Release publications
Features:
- Builds Docker image using multi-platform support
- Pushes to GitHub Container Registry (GHCR)
- Automatic tagging based on branch, commit, and releases
- Security scanning with Trivy
- Runs tests on pull requests
- Caching for faster builds
Usage:
# Pull the latest image
docker pull ghcr.io/YOUR_USERNAME/slaking:latest
# Run the container
docker run -d \
-e SLACK_BOT_TOKEN=your_token \
-e SLACK_SIGNING_SECRET=your_secret \
-e KUBERNETES_CONFIG_PATH=/path/to/kubeconfig \
ghcr.io/YOUR_USERNAME/slaking:latestFile: .github/workflows/publish-helm.yml
Triggers:
- Push to
mainbranch (when Helm chart changes) - Release publications
Features:
- Lints and validates Helm charts
- Packages charts with proper metadata
- Publishes to GitHub Pages
- Updates chart versions on releases
- Creates Helm repository index
Usage:
# Add the Helm repository
helm repo add slaking https://YOUR_USERNAME.github.io/slaking
helm repo update
# Install Slaking
helm install slaking slaking/slaking \
--set slack.botToken=your_token \
--set slack.signingSecret=your_secretFile: .github/workflows/setup-pages.yml
Triggers:
- Manual workflow dispatch
Features:
- Sets up GitHub Pages for Helm chart hosting
- Creates a landing page for the Helm repository
- Provides installation instructions
- Go to your repository settings
- Navigate to "Pages" section
- Set source to "GitHub Actions"
- Run the "Setup GitHub Pages" workflow manually
The workflows use the following secrets (automatically provided by GitHub):
GITHUB_TOKEN- Automatically provided, no setup needed
- Go to your repository settings
- Navigate to "Packages" section
- Ensure "Inherit access from source repository" is enabled
Update the following files with your actual repository information:
- Chart.yaml - Update maintainer information
- README.md - Update installation instructions
- Values.yaml - Update default values
To customize the container build:
- Modify
Dockerfilefor different base images or build steps - Update
.github/workflows/deploy-container.ymlfor different build contexts - Add build arguments or multi-stage builds as needed
To customize the Helm chart publishing:
- Modify
charts/slaking/Chart.yamlfor metadata - Update
charts/slaking/values.yamlfor default values - Add additional chart dependencies if needed
- Customize the GitHub Pages landing page in
setup-pages.yml
To modify when workflows run:
- Edit the
onsection in each workflow file - Add path filters to only trigger on specific file changes
- Add environment-specific triggers
- Trivy Scanning: Automatically scans for vulnerabilities
- Non-root User: Container runs as non-root user
- Multi-stage Builds: Minimizes attack surface
- Dependency Scanning: Monitors for known vulnerabilities
- Chart Linting: Validates chart structure and metadata
- Template Validation: Ensures templates render correctly
- Version Management: Automatic version updates on releases
- Permission Denied: Ensure workflows have proper permissions
- Build Failures: Check Dockerfile and dependencies
- Chart Publishing Issues: Verify Helm chart structure
- Pages Not Updating: Check GitHub Pages settings
- Check workflow logs in the Actions tab
- Verify repository secrets and permissions
- Test workflows locally using
act(GitHub Actions local runner) - Review container registry and pages settings
- Version Management: Use semantic versioning for releases
- Security: Regularly update dependencies and base images
- Testing: Add comprehensive tests to workflows
- Documentation: Keep installation instructions updated
- Monitoring: Monitor workflow success rates and build times
For issues with the GitHub Actions setup:
- Check the workflow logs in the Actions tab
- Review this documentation
- Open an issue in the repository
- Check GitHub Actions documentation for specific errors