Skip to content

Commit 938f76d

Browse files
Add release workflow for publishing Helm chart to ECR (#23)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fe6b7e7 commit 938f76d

8 files changed

Lines changed: 118 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,78 @@ jobs:
1818
release:
1919
name: Package and publish Helm chart
2020
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
env:
24+
CHART_VERSION: ${{ inputs.draft && format('{0}-draft', inputs.version) || inputs.version }}
25+
APP_VERSION: ${{ inputs.version }}
2126
steps:
22-
- name: Placeholder
23-
run: echo "This is a scaffold. The full implementation is in PR #23."
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Helm
31+
uses: azure/setup-helm@v4
32+
with:
33+
version: v3.14.4
34+
35+
- name: Set chart version and appVersion
36+
run: |
37+
set -euo pipefail
38+
sed -i "s/^version:.*/version: $CHART_VERSION/" chart/Chart.yaml
39+
sed -i "s/^appVersion:.*/appVersion: \"$APP_VERSION\"/" chart/Chart.yaml
40+
sed -i 's/^ version: .*/ version: "'"$APP_VERSION"'"/' chart/values.yaml
41+
echo "### Chart.yaml" >> $GITHUB_STEP_SUMMARY
42+
echo '```yaml' >> $GITHUB_STEP_SUMMARY
43+
cat chart/Chart.yaml >> $GITHUB_STEP_SUMMARY
44+
echo '```' >> $GITHUB_STEP_SUMMARY
45+
46+
- name: Lint chart
47+
run: helm lint chart
48+
49+
- name: Package chart
50+
run: |
51+
set -euo pipefail
52+
pkg_output=$(helm package chart --version "$CHART_VERSION" --app-version "$APP_VERSION")
53+
echo "$pkg_output"
54+
chart_package=$(printf '%s\n' "$pkg_output" | awk '/Successfully packaged chart and saved it to:/ {print $NF}')
55+
echo "CHART_PACKAGE=$chart_package" >> "$GITHUB_ENV"
56+
57+
- name: Configure AWS credentials
58+
uses: aws-actions/configure-aws-credentials@v4
59+
with:
60+
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
61+
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
62+
aws-region: ${{ vars.ECR_PUBLIC_REGION }}
63+
64+
- name: Push chart to public ECR
65+
run: |
66+
set -euo pipefail
67+
aws ecr-public get-login-password --region ${{ vars.ECR_PUBLIC_REGION }} \
68+
| helm registry login --username AWS --password-stdin public.ecr.aws
69+
helm push "$CHART_PACKAGE" oci://public.ecr.aws/openops/helm
70+
echo "- ✅ Pushed \`oci://public.ecr.aws/openops/helm/openops:${CHART_VERSION}\`" >> $GITHUB_STEP_SUMMARY
71+
72+
- name: Create GitHub release
73+
uses: softprops/action-gh-release@v2
74+
with:
75+
target_commitish: ${{ github.sha }}
76+
tag_name: ${{ env.CHART_VERSION }}
77+
name: openops-${{ env.CHART_VERSION }}
78+
generate_release_notes: true
79+
draft: ${{ inputs.draft }}
80+
files: ${{ env.CHART_PACKAGE }}
81+
82+
- name: Write summary
83+
run: |
84+
echo "### Helm Chart Release" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
87+
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
88+
echo "| Chart version | \`$CHART_VERSION\` |" >> $GITHUB_STEP_SUMMARY
89+
echo "| App version | \`$APP_VERSION\` |" >> $GITHUB_STEP_SUMMARY
90+
echo "| Draft | \`${{ inputs.draft }}\` |" >> $GITHUB_STEP_SUMMARY
91+
echo "" >> $GITHUB_STEP_SUMMARY
92+
echo "Install with:" >> $GITHUB_STEP_SUMMARY
93+
echo '```bash' >> $GITHUB_STEP_SUMMARY
94+
echo "helm install openops oci://public.ecr.aws/openops/helm/openops --version $CHART_VERSION" >> $GITHUB_STEP_SUMMARY
95+
echo '```' >> $GITHUB_STEP_SUMMARY

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@
3434
- **Helm tests**: Post-installation connectivity tests to validate deployment health.
3535
- **Validation helpers**: Runtime validation of required secrets (OPS_ENCRYPTION_KEY, OPS_JWT_SECRET, etc.) with helpful error messages at render time.
3636

37+
## Release workflow
38+
- **`.github/workflows/release.yml`**: Packages the Helm chart and pushes it as an OCI artifact to `public.ecr.aws/openops/helm/openops`.
39+
- Triggered via `workflow_dispatch` with two inputs:
40+
- `version` (required): The release version (e.g., `0.6.15`). Sets both `Chart.yaml` version/appVersion and `global.version` (image tags).
41+
- `draft` (boolean, default `true`): When true, appends `-draft` to the chart version (e.g., `0.6.15-draft`). Draft versions are overwritable on ECR; final versions are immutable.
42+
- Also triggered cross-repo by `openops-cloud/openops` release workflow.
43+
- Creates a GitHub release (draft or published) with the packaged `.tgz` as an asset.
44+
- **Do not bump versions in `Chart.yaml` or `values.yaml` manually**—the release workflow sets them at build time. The repo defaults are `version: 0.0.1-dev` and `appVersion: 0.0.1-dev`.
45+
- Required secrets: `ECR_ACCESS_KEY_ID`, `ECR_SECRET_ACCESS_KEY`; required vars: `ECR_PUBLIC_REGION`.
46+
47+
## Versioning strategy
48+
- All *release* versions are unified: chart version = appVersion = `global.version` (image tags) = OpenOps release version. The in-repo development defaults (`0.0.1-dev`) are normalized by the release workflow.
49+
- Exception: draft releases use `{version}-draft` for the chart version only; `appVersion` and image tags use the clean version.
50+
- The chart is published to `oci://public.ecr.aws/openops/helm/openops`. Users install with:
51+
```
52+
helm install openops oci://public.ecr.aws/openops/helm/openops --version <VERSION>
53+
```
54+
3755
## PR lint rules
3856
The `.github/prlint.json` ruleset runs on every pull request. To avoid CI failures:
3957
1. **Title requirements**

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ This repository contains the Helm chart that deploys the OpenOps application sta
2424
- **redis**: Redis cache.
2525

2626
## Quick start
27+
28+
### Install from OCI registry (recommended)
29+
30+
```bash
31+
helm install openops oci://public.ecr.aws/openops/helm/openops \
32+
--version <VERSION> \
33+
-n openops --create-namespace \
34+
-f values.overrides.yaml
35+
```
36+
37+
### Install from source
38+
2739
1. Copy the sample overrides file and adjust it to match your environment:
2840
```bash
2941
cp chart/values.overrides-example.yaml chart/values.overrides.yaml

chart/Chart.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
apiVersion: v2
2-
name: openops
3-
description: A Helm chart for the OpenOps platform
4-
type: application
5-
version: 0.4.0
6-
appVersion: "0.6.14"
7-
icon: https://openops.com/favicon.ico
1+
apiVersion: v2
2+
name: openops
3+
description: A Helm chart for the OpenOps platform
4+
type: application
5+
version: 0.0.1-dev
6+
appVersion: "0.0.1-dev"
7+
icon: https://openops.com/favicon.ico

chart/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Useful commands:
118118
helm test {{ .Release.Name }} -n {{ .Release.Namespace }}
119119

120120
# Upgrade deployment
121-
helm upgrade {{ .Release.Name }} ./chart -f values.production.yaml
121+
helm upgrade {{ .Release.Name }} oci://public.ecr.aws/openops/helm/{{ .Chart.Name }} --version {{ .Chart.Version }} -n {{ .Release.Namespace }} -f values.overrides.yaml
122122

123123
# Uninstall
124124
helm uninstall {{ .Release.Name }} -n {{ .Release.Namespace }}

chart/values.ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# Includes test secrets - NOT FOR PRODUCTION
44

55
global:
6+
# Use latest published images for CI (repo default 0.0.1-dev does not exist in ECR)
7+
version: "latest"
8+
69
# Allow single replica for CI
710
allowSingleReplica: true
811

chart/values.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"properties": {
1212
"version": {
1313
"type": "string",
14-
"description": "Immutable version tag for app and engine images (semver or 8-char git hash)",
15-
"pattern": "^([0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9.-]+)?|[0-9a-fA-F]{8})$"
14+
"description": "Immutable version tag for app and engine images (semver, 8-char git hash, or 'latest')",
15+
"pattern": "^([0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9.-]+)?|[0-9a-fA-F]{8}|latest)$"
1616
}
1717
}
1818
},

chart/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
global:
2-
version: "0.6.14"
2+
version: "0.0.1-dev"
33

44
# Public URL - single source of truth for domain configuration
55
# This is used to derive ingress host and all *_PUBLIC_URL environment variables

0 commit comments

Comments
 (0)