Skip to content

Commit f30060f

Browse files
committed
feat(workflows): reorganize workflow files and add documentation
1 parent 7003d03 commit f30060f

File tree

195 files changed

+470
-5449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+470
-5449
lines changed

.github/workflows/charts-release.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Helm Charts Index
2+
3+
on:
4+
workflow_dispatch:
5+
repository_dispatch:
6+
types: [release]
7+
8+
9+
concurrency:
10+
group: helm-charts-index
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
name: build
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: tools - helm - install
19+
uses: azure/setup-helm@v4
20+
21+
- name: tools - helm - login - ghcr.io
22+
run: echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
23+
24+
- name: tools - oras - install
25+
uses: oras-project/setup-oras@v1
26+
27+
- name: tools - oras - login - ghcr.io
28+
run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
29+
30+
- name: helm - pull charts
31+
run: |
32+
set -euo pipefail
33+
34+
echo "📦 Fetching chart list from GitHub API..."
35+
charts=$(curl -s -H "Authorization: Bearer ${{ secrets.ES_GITHUB_PAT }}" \
36+
-H "Accept: application/vnd.github+json" \
37+
https://api.github.com/orgs/${{ github.repository_owner }}/packages?package_type=container \
38+
| jq -r '.[] | select(.name | startswith("helm-charts/")) | .name')
39+
40+
if [[ -z "$charts" ]]; then
41+
echo "❌ No charts found under helm-charts/"
42+
exit 1
43+
fi
44+
45+
for chart in $charts; do
46+
echo "🔽 Chart: $chart"
47+
full_ref="ghcr.io/${{ github.repository_owner }}/$chart"
48+
49+
# Get all tags (versions) using ORAS
50+
tags=$(oras repo tags "$full_ref" 2>/dev/null || true)
51+
52+
if [[ -z "$tags" ]]; then
53+
echo " ⚠️ No tags found for $full_ref"
54+
continue
55+
fi
56+
57+
echo "$tags" | sort -V | while read -r tag; do
58+
[[ -z "$tag" ]] && continue
59+
echo " → Tag: $tag"
60+
# Strip prefix to get the actual chart name
61+
helm_chart="${chart#helm-charts/}"
62+
63+
echo " 📥 Pulling chart: $helm_chart, version: $tag"
64+
mkdir -p .artifacts/helm/repository/$helm_chart
65+
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/$helm_chart \
66+
--version "$tag" \
67+
--destination .artifacts/helm/repository/$helm_chart
68+
done
69+
done
70+
71+
- name: helm - repo - index
72+
run: |
73+
cd .artifacts/helm
74+
helm repo index repository --url "repository"
75+
helm repo index --merge repository/index.yaml .
76+
rm repository/index.yaml
77+
78+
- name: helm - fix - replace icons
79+
run: |
80+
# Path to the file to modify
81+
target_file=".artifacts/helm/index.yaml"
82+
sed -i 's|icon: https://raw.githubusercontent.com/emberstack/CDN[^ ]*|icon: https://raw.githubusercontent.com/emberstack/helm-charts/main/assets/helm_icon_generic.png|gI' "$target_file"
83+
84+
- name: Generate index.html redirect
85+
run: |
86+
mkdir -p .artifacts/helm
87+
88+
printf '%s\n' \
89+
'<!DOCTYPE html>' \
90+
'<html lang="en">' \
91+
' <head>' \
92+
' <meta http-equiv="refresh" content="0; url=https://github.com/emberstack/helm-charts" />' \
93+
' <meta name="robots" content="noindex">' \
94+
' <title>Redirecting...</title>' \
95+
' </head>' \
96+
' <body>' \
97+
' <p>If you are not redirected automatically, <a href="https://github.com/emberstack/helm-charts">click here</a>.</p>' \
98+
' </body>' \
99+
'</html>' > .artifacts/helm/index.html
100+
101+
- name: artifacthub - generate artifacthub-repo.yml
102+
run: |
103+
mkdir -p .artifacts/helm
104+
printf '%s\n' 'repositoryID: a16c06b8-a82e-4411-a741-07fd9a83ef9a' > .artifacts/helm/artifacthub-repo.yml
105+
106+
- name: artifacts - upload github-pages
107+
uses: actions/upload-pages-artifact@v3
108+
with:
109+
path: .artifacts/helm
110+
111+
112+
deploy:
113+
needs: build
114+
runs-on: ubuntu-latest
115+
permissions:
116+
pages: write
117+
id-token: write
118+
environment:
119+
name: github-pages
120+
url: ${{ steps.deployment.outputs.page_url }}
121+
steps:
122+
- name: github pages - deploy
123+
id: deployment
124+
uses: actions/deploy-pages@v4

.github/workflows/pipeline.yaml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
name: Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- "**" # Matches all branches
7+
pull_request:
8+
branches:
9+
- "**" # Matches all branches
10+
11+
workflow_dispatch:
12+
inputs:
13+
force_build:
14+
description: "Forces a build even if no changes are detected"
15+
required: true
16+
default: "false"
17+
force_release:
18+
description: "Forces a release even if no changes are detected"
19+
required: true
20+
default: "false"
21+
22+
concurrency:
23+
group: pipeline-${{ github.ref_name }}
24+
cancel-in-progress: true
25+
26+
env:
27+
helm_chart_repository: "ghcr.io/emberstack/helm-charts"
28+
helm_chart_repository_protocol: "oci://"
29+
30+
jobs:
31+
discovery:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
35+
pull-requests: read
36+
outputs:
37+
pathsFilter_src: ${{ steps.pathsFilter.outputs.src }}
38+
gitVersion_SemVer: ${{ steps.gitversion.outputs.GitVersion_SemVer }}
39+
gitVersion_AssemblySemFileVer: ${{ steps.gitversion.outputs.GitVersion_AssemblySemFileVer }}
40+
build: ${{ steps.evaluate_build.outputs.result }}
41+
build_configuration: ${{ steps.evaluate_build_configuration.outputs.result }}
42+
release: ${{ steps.evaluate_release.outputs.result }}
43+
steps:
44+
- name: checkout
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
49+
- name: tools - dotnet - install
50+
uses: actions/setup-dotnet@v4
51+
with:
52+
dotnet-version: "9.x"
53+
54+
- name: tools - gitversion - install
55+
uses: gittools/actions/gitversion/[email protected]
56+
with:
57+
versionSpec: "5.x"
58+
preferLatestVersion: true
59+
60+
- name: gitversion - execute
61+
id: gitversion
62+
uses: gittools/actions/gitversion/[email protected]
63+
with:
64+
useConfigFile: true
65+
configFilePath: GitVersion.yaml
66+
67+
- name: tools - detect changes
68+
id: pathsFilter
69+
uses: dorny/paths-filter@v3
70+
with:
71+
base: ${{ github.ref }}
72+
filters: |
73+
src:
74+
- '*.sln'
75+
- '*.slnx'
76+
- '*.props'
77+
- 'src/**'
78+
build:
79+
- '*.sln'
80+
- '*.slnx'
81+
- '*.props'
82+
- 'src/**'
83+
- 'tests/**'
84+
- 'playground/**'
85+
86+
- name: evaluate - build
87+
id: evaluate_build
88+
run: |
89+
if [ "${{ steps.pathsFilter.outputs.build }}" = "true" ] || \
90+
[ "${{ github.event.inputs.force_build }}" = "true" ] || \
91+
[ "${{ github.event.inputs.force_release }}" = "true" ]; then
92+
result=true
93+
else
94+
result=false
95+
fi
96+
echo "result=$result" >> $GITHUB_OUTPUT
97+
98+
- name: evaluate - build_configuration
99+
id: evaluate_build_configuration
100+
run: |
101+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
102+
result=Release
103+
else
104+
result=Debug
105+
fi
106+
echo "result=$result" >> $GITHUB_OUTPUT
107+
108+
- name: evaluate - release
109+
id: evaluate_release
110+
run: |
111+
if [ "${{ github.ref }}" = "refs/heads/main" ] || \
112+
[ "${{ github.event.inputs.force_release }}" = "true" ]; then
113+
result=true
114+
else
115+
result=false
116+
fi
117+
echo "result=$result" >> $GITHUB_OUTPUT
118+
119+
build:
120+
name: build
121+
if: ${{ needs.discovery.outputs.build == 'true' }}
122+
needs: [discovery]
123+
runs-on: ubuntu-latest
124+
env:
125+
build: ${{ needs.discovery.outputs.build }}
126+
build_configuration: ${{ needs.discovery.outputs.build_configuration }}
127+
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
128+
gitVersion_AssemblySemFileVer: ${{ needs.discovery.outputs.gitVersion_AssemblySemFileVer }}
129+
steps:
130+
- name: checkout
131+
uses: actions/checkout@v4
132+
133+
- name: artifacts - prepare directories
134+
run: |
135+
mkdir -p .artifacts/helm
136+
mkdir -p .artifacts/helm/repository
137+
mkdir -p .artifacts/kubectl
138+
139+
- name: tools - helm - install
140+
uses: azure/setup-helm@v4
141+
142+
- name: helm - package
143+
run: |
144+
for dir in src/charts/*; do
145+
[ -d "$dir" ] || continue
146+
helm_chart=$(basename "$dir")
147+
dest_dir=".artifacts/helm"
148+
mkdir -p "$dest_dir"
149+
helm package "$dir" --destination "$dest_dir" --version ${{ env.gitVersion_SemVer }} --app-version ${{ env.gitVersion_SemVer }}
150+
echo "Packaged $helm_chart to $dest_dir"
151+
done
152+
153+
- name: artifacts - helm - upload
154+
uses: actions/upload-artifact@v4
155+
with:
156+
name: artifacts-helm-${{env.gitVersion_SemVer}}
157+
path: .artifacts/helm
158+
159+
release:
160+
name: release
161+
if: ${{ needs.discovery.outputs.release == 'true' }}
162+
needs: [discovery, build]
163+
runs-on: ubuntu-latest
164+
env:
165+
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
166+
gitVersion_AssemblySemFileVer: ${{ needs.discovery.outputs.gitVersion_AssemblySemFileVer }}
167+
steps:
168+
169+
- name: artifacts - helm - download
170+
uses: actions/download-artifact@v4
171+
with:
172+
name: artifacts-helm-${{env.gitVersion_SemVer}}
173+
path: .artifacts/helm
174+
175+
- name: tools - helm - install
176+
uses: azure/setup-helm@v4
177+
178+
- name: tools - helm - login - ghcr.io
179+
run: echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
180+
181+
- name: tools - oras - install
182+
uses: oras-project/setup-oras@v1
183+
184+
- name: tools - oras - login - ghcr.io
185+
run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
186+
187+
- name: Find and inspect all .tgz Helm charts in .artifacts/helm
188+
run: |
189+
set -euo pipefail
190+
191+
echo "🔍 Searching for .tgz Helm charts in '.artifacts/helm/'..."
192+
find .artifacts/helm -type f -name '*.tgz' | while read -r chart; do
193+
echo "📦 Chart file: $chart"
194+
195+
# Extract chart metadata
196+
metadata=$(helm show chart "$chart")
197+
name=$(echo "$metadata" | awk '/^name:/ { print $2 }')
198+
version=$(echo "$metadata" | awk '/^version:/ { print $2 }')
199+
200+
echo " → Name: $name"
201+
echo " → Version: $version"
202+
203+
helm push "$chart" ${{ env.helm_chart_repository_protocol }}${{ env.helm_chart_repository }}
204+
done
205+
206+
- name: github - release - create
207+
uses: softprops/action-gh-release@v2
208+
with:
209+
repository: ${{ github.repository }}
210+
name: v${{ env.gitVersion_SemVer }}
211+
tag_name: v${{ env.gitVersion_SemVer }}
212+
body: The release process is automated.
213+
generate_release_notes: true
214+
token: ${{ secrets.ES_GITHUB_PAT }}
215+
216+
- name: Repository Dispatch
217+
uses: peter-evans/repository-dispatch@v3
218+
with:
219+
token: ${{ secrets.ES_GITHUB_PAT }}
220+
repository: emberstack/helm-charts
221+
event-type: release
222+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
223+

0 commit comments

Comments
 (0)