Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name-template: 'Docker Image docker-v$RESOLVED_VERSION'
tag-template: 'docker-v$RESOLVED_VERSION'
tag-prefix: docker-v
filter-by-commitish: false
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
template: |
## Changes

$CHANGES

## Docker image

```sh
docker pull ghcr.io/michaelsp/infra-eye:docker-v$RESOLVED_VERSION
```

Supported platforms: linux/amd64, linux/arm64.
199 changes: 41 additions & 158 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,176 +1,59 @@
# GitHub Actions Workflows
# CI and releases

This directory contains automated CI/CD workflows for the infra-eye project.
## Main builds and draft releases

## Workflows
`docker-publish.yml` lints, tests, and builds on every PR and push to `main`,
including chart changes. PRs build without pushing. Successful main builds push
multi-platform images (amd64/arm64) to `ghcr.io/michaelsp/infra-eye`, tagged with
`main`, `latest`, and the next `docker-vX.Y.Z` version.

### 1. Docker Image Build and Publish (`docker-publish.yml`)
The existing semver action calculates the version from conventional commits.
[Release Drafter](https://github.com/release-drafter/release-drafter) then creates
or updates one draft release with merged PR notes and the exact built commit SHA.
Until publication, later main builds may update the draft version and image.

Builds and publishes the Docker image to GitHub Container Registry (ghcr.io).
## Weekly publication

**Triggers:**
- Push to `main` branch
- Git tags matching `v*.*.*` (e.g., v1.0.0)
- Pull requests to `main` (build only, no push)
- Manual workflow dispatch
`release-publish.yml` runs Mondays at **08:00 UTC** (09:00 CET / 10:00 CEST).
It can also be run manually on `main`. If no Docker draft exists, it does nothing.

**Features:**
- Multi-architecture builds (linux/amd64, linux/arm64)
- Automatic versioning using semantic versioning from git tags
- Layer caching for faster builds
- Tagged images:
- `latest` (main branch)
- Semantic versions from tags (e.g., `v1.0.0`, `v1.0`, `v1`)
- Branch names for feature branches
- Commit SHA for tracking
For an existing draft, it:

**Usage:**
```bash
# Pull the latest image
docker pull ghcr.io/michaelsp/infra-eye:latest
1. Checks out the exact commit recorded in the draft.
2. Packages the Helm chart with version `X.Y.Z` and appVersion `docker-vX.Y.Z`,
so the default deployment image matches the built Docker tag.
3. Uses the community Helm chart-releaser action to publish the chart archive
and update the `gh-pages` Helm index; also pushes the chart to
`oci://ghcr.io/michaelsp/infra-eye`.
4. Uses [softprops/action-gh-release](https://github.com/softprops/action-gh-release)
to publish the existing Docker draft and mark it latest.

# Pull a specific version
docker pull ghcr.io/michaelsp/infra-eye:v1.0.0
Publication and main image builds share a concurrency lock. Chart publication
happens first so a failure leaves the draft available for retry. Existing chart
releases are skipped on retry. Multiple Docker drafts fail explicitly rather
than choosing one arbitrarily.

# Run the container
docker run -p 3000:3000 ghcr.io/michaelsp/infra-eye:latest
```

### 2. Helm Chart Build and Publish (`helm-publish.yml`)

Packages and publishes the Helm chart to multiple destinations.
Chart versions are set in the packaging workspace. No chart bump PR, auto-merge,
merge polling, or follow-up workflow dispatch is needed. Source Chart.yaml stays
as the development default.

**Triggers:**
- Push to `main` branch (when chart files change)
- Git tags matching `v*.*.*`
- Pull requests to `main` (lint and test only)
- Manual workflow dispatch
`chart-0-test.yml` additionally lints and tests chart-related PRs.

**Features:**
- Helm chart linting and validation
- Automatic version management:
- Tags: Uses git tag version (e.g., `v1.0.0` → `1.0.0`)
- Main branch: Uses Chart.yaml version with commit SHA (e.g., `0.1.0-a1b2c3d`)
- Publishes to three locations:
1. **OCI Registry (ghcr.io)** - Modern Helm chart distribution
2. **GitHub Releases** - Downloadable chart archives (on tags)
3. **GitHub Pages** - Traditional Helm repository
## Permissions and setup

**Usage:**
Main builds need `contents: write`, `packages: write`, and `pull-requests: read`
for drafts, images, and release notes. Weekly publishing needs `contents: write`
and `packages: write`. Both use the built-in `GITHUB_TOKEN`; no PAT is needed.

#### Using OCI Registry (Recommended):
```bash
# Install from OCI registry
helm install infra-eye oci://ghcr.io/michaelsp/charts/infra-eye --version 1.0.0

# Upgrade
helm upgrade infra-eye oci://ghcr.io/michaelsp/charts/infra-eye --version 1.0.1
```
Configure GitHub Pages to publish from the `gh-pages` branch. The Helm repository
is available at https://michaelsp.github.io/infra-eye. Make GHCR packages public
if anonymous installs are required.

#### Using GitHub Pages:
```bash
# Add the Helm repository
```sh
helm repo add infra-eye https://michaelsp.github.io/infra-eye

# Update repo index
helm repo update
helm install infra-eye infra-eye/infra-eye --version X.Y.Z

# Install the chart
helm install my-infra-eye infra-eye/infra-eye

# Search available versions
helm search repo infra-eye -l
```

#### Using GitHub Releases:
Download the chart archive from the [Releases page](https://github.com/MichaelSp/infra-eye/releases) and install:
```bash
helm install infra-eye ./infra-eye-1.0.0.tgz
# OCI alternative
helm install infra-eye oci://ghcr.io/michaelsp/infra-eye/infra-eye --version X.Y.Z
```

## Release Process

To create a new release with both Docker image and Helm chart:

1. **Update version in Chart.yaml** (if needed):
```yaml
version: 1.0.0
appVersion: "1.0.0"
```

2. **Commit changes**:
```bash
git add chart/infra-eye/Chart.yaml
git commit -m "chore: bump version to 1.0.0"
git push origin main
```

3. **Create and push a git tag**:
```bash
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
```

4. **Workflows will automatically**:
- Build and push Docker image with tag `v1.0.0`, `v1.0`, `v1`, and `latest`
- Package and publish Helm chart version `1.0.0`
- Create a GitHub Release with chart archive attached
- Update GitHub Pages repository index

## Permissions Required

The workflows require the following GitHub permissions:
- `contents: write` - For creating releases and updating gh-pages
- `packages: write` - For publishing to GitHub Container Registry
- `pages: write` - For deploying to GitHub Pages
- `id-token: write` - For OIDC authentication

These are automatically granted through `GITHUB_TOKEN` in GitHub Actions.

## Configuration

### GitHub Pages Setup

To enable the GitHub Pages Helm repository:

1. Go to repository **Settings** → **Pages**
2. Under "Build and deployment":
- Source: **Deploy from a branch**
- Branch: **gh-pages** / **(root)**
3. Save changes

The Helm repository will be available at: `https://michaelsp.github.io/infra-eye`

### Container Registry Visibility

To make Docker images and Helm charts public:

1. Go to the [package settings](https://github.com/users/MichaelSp/packages)
2. Find `infra-eye` (Docker) and `charts/infra-eye` (Helm)
3. Click on each package → **Package settings**
4. Scroll to "Danger Zone" → **Change visibility** → Make public

## Troubleshooting

### Workflow fails with "403 Forbidden"
- Ensure GitHub Actions has permission to write to packages
- Check repository settings → Actions → General → Workflow permissions → Enable "Read and write permissions"

### Helm chart push fails
- Verify the chart version is not already published
- Ensure Chart.yaml has valid semantic versioning

### GitHub Pages not updating
- Check if gh-pages branch exists and has content
- Verify GitHub Pages is enabled in repository settings
- Allow a few minutes for GitHub Pages to deploy after the workflow completes

## Manual Workflow Execution

You can manually trigger workflows from the GitHub Actions tab:

1. Go to **Actions** tab
2. Select the workflow (Docker or Helm)
3. Click **Run workflow**
4. Choose the branch
5. Click **Run workflow** button
4 changes: 1 addition & 3 deletions .github/workflows/chart-0-test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Helm Chart - 0 Test and Lint

description: |
Lint and test Helm chart.

on:
pull_request:
branches:
- main
paths:
- "chart/**"
- ".github/workflows/chart-*.yml"
- ".github/workflows/release-publish.yml"
workflow_dispatch:

permissions:
Expand Down
83 changes: 0 additions & 83 deletions .github/workflows/chart-1-publish.yml

This file was deleted.

Loading
Loading