Skip to content

Commit c7f0d3a

Browse files
Updated releaser gh action CI
1 parent cd1abb7 commit c7f0d3a

File tree

1 file changed

+25
-154
lines changed

1 file changed

+25
-154
lines changed
Lines changed: 25 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,33 @@
1-
name: Release Helm Chart
1+
name: Release Charts
22

33
on:
44
push:
5-
tags:
6-
- 'chart-*-v*'
7-
workflow_dispatch:
8-
inputs:
9-
chart_name:
10-
description: 'Chart name (e.g., osmosis-fullnode)'
11-
required: true
12-
type: string
13-
version:
14-
description: 'Chart version (e.g., 1.0.0)'
15-
required: true
16-
type: string
17-
dry_run:
18-
description: 'Dry run (skip actual release steps)'
19-
required: false
20-
default: false
21-
type: boolean
22-
23-
env:
24-
REGISTRY: ghcr.io
25-
GH_USER: osmobot
5+
branches:
6+
- main
267

278
jobs:
289
release:
29-
runs-on: ubuntu-latest
3010
permissions:
31-
contents: write # Required for creating releases and uploading assets
32-
packages: write # Required for pushing to GHCR
33-
11+
contents: write
12+
runs-on: ubuntu-latest
3413
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v4
37-
38-
- name: Set up Helm
39-
uses: azure/setup-helm@v3
40-
with:
41-
version: v3.13.0
42-
43-
- name: Extract chart name and version from tag
44-
id: extract
45-
run: |
46-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
47-
# Manual trigger - use inputs
48-
CHART_NAME="${{ github.event.inputs.chart_name }}"
49-
VERSION="${{ github.event.inputs.version }}"
50-
echo "Manual trigger detected"
51-
echo "Using inputs: chart=$CHART_NAME, version=$VERSION"
52-
else
53-
# Tag trigger - extract from tag
54-
TAG_NAME=${GITHUB_REF#refs/tags/}
55-
echo "Tag trigger detected: $TAG_NAME"
56-
57-
# Remove 'chart-' prefix and extract chart name and version
58-
TEMP=${TAG_NAME#chart-} # Remove 'chart-' prefix
59-
CHART_NAME=${TEMP%-v*} # Extract chart name (everything before '-v')
60-
VERSION=${TEMP#*-v} # Extract version (everything after '-v')
61-
62-
echo "Extracted from tag: chart=$CHART_NAME, version=$VERSION"
63-
fi
64-
65-
echo "chart_name=$CHART_NAME" >> $GITHUB_OUTPUT
66-
echo "version=$VERSION" >> $GITHUB_OUTPUT
67-
echo "Final values: chart=$CHART_NAME, version=$VERSION"
68-
69-
- name: Validate chart exists
70-
run: |
71-
if [ ! -d "charts/${{ steps.extract.outputs.chart_name }}" ]; then
72-
echo "Error: Chart directory 'charts/${{ steps.extract.outputs.chart_name }}' does not exist"
73-
exit 1
74-
fi
75-
echo "Chart directory exists: charts/${{ steps.extract.outputs.chart_name }}"
76-
77-
- name: Display Chart.yaml before update
78-
run: |
79-
echo "=== Current Chart.yaml ==="
80-
cat charts/${{ steps.extract.outputs.chart_name }}/Chart.yaml
81-
echo "=========================="
82-
83-
- name: Update Chart version
84-
run: |
85-
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
86-
echo "🔍 DRY RUN: Would update Chart.yaml version to ${{ steps.extract.outputs.version }}"
87-
echo "Current version line:"
88-
grep "^version:" charts/${{ steps.extract.outputs.chart_name }}/Chart.yaml
89-
else
90-
sed -i "s/^version:.*/version: ${{ steps.extract.outputs.version }}/" charts/${{ steps.extract.outputs.chart_name }}/Chart.yaml
91-
echo "Updated Chart.yaml version to ${{ steps.extract.outputs.version }}"
92-
fi
93-
94-
- name: Display Chart.yaml after update
95-
if: github.event.inputs.dry_run != 'true'
96-
run: |
97-
echo "=== Updated Chart.yaml ==="
98-
cat charts/${{ steps.extract.outputs.chart_name }}/Chart.yaml
99-
echo "=========================="
100-
101-
- name: Login to GitHub Container Registry
102-
if: github.event.inputs.dry_run != 'true'
103-
uses: docker/login-action@v3
104-
with:
105-
registry: ${{ env.REGISTRY }}
106-
username: ${{ env.GH_USER }}
107-
password: ${{ secrets.GH_TOKEN }}
108-
109-
- name: Package Helm Chart
110-
run: |
111-
helm package charts/${{ steps.extract.outputs.chart_name }}/ --destination .
112-
echo "Packaged chart: ${{ steps.extract.outputs.chart_name }}-${{ steps.extract.outputs.version }}.tgz"
113-
ls -la *.tgz
114-
115-
- name: Push Chart to GHCR
116-
if: github.event.inputs.dry_run != 'true'
117-
run: |
118-
helm push ${{ steps.extract.outputs.chart_name }}-${{ steps.extract.outputs.version }}.tgz oci://${{ env.REGISTRY }}/${{ github.repository_owner }}/charts
119-
120-
- name: Create GitHub Release
121-
if: github.event.inputs.dry_run != 'true'
122-
uses: softprops/action-gh-release@v1
123-
with:
124-
tag_name: chart-${{ steps.extract.outputs.chart_name }}-v${{ steps.extract.outputs.version }}
125-
name: "Chart Release: ${{ steps.extract.outputs.chart_name }} v${{ steps.extract.outputs.version }}"
126-
files: |
127-
${{ steps.extract.outputs.chart_name }}-${{ steps.extract.outputs.version }}.tgz
128-
generate_release_notes: true
129-
body: |
130-
## Helm Chart Release: ${{ steps.extract.outputs.chart_name }} v${{ steps.extract.outputs.version }}
131-
132-
### Installation
133-
```bash
134-
helm install ${{ steps.extract.outputs.chart_name }} oci://${{ env.REGISTRY }}/${{ github.repository_owner }}/charts/${{ steps.extract.outputs.chart_name }} --version ${{ steps.extract.outputs.version }}
135-
```
136-
137-
### What's Changed
138-
- Chart: ${{ steps.extract.outputs.chart_name }}
139-
- Version: ${{ steps.extract.outputs.version }}
140-
141-
See [README](https://github.com/${{ github.repository }}/blob/main/charts/${{ steps.extract.outputs.chart_name }}/README.md) for detailed configuration options.
142-
143-
- name: Dry Run Summary
144-
if: github.event.inputs.dry_run == 'true'
145-
run: |
146-
echo "🔍 DRY RUN SUMMARY" >> $GITHUB_STEP_SUMMARY
147-
echo "=================" >> $GITHUB_STEP_SUMMARY
148-
echo "Chart: ${{ steps.extract.outputs.chart_name }}" >> $GITHUB_STEP_SUMMARY
149-
echo "Version: ${{ steps.extract.outputs.version }}" >> $GITHUB_STEP_SUMMARY
150-
echo "Chart packaged successfully: ${{ steps.extract.outputs.chart_name }}-${{ steps.extract.outputs.version }}.tgz" >> $GITHUB_STEP_SUMMARY
151-
echo "" >> $GITHUB_STEP_SUMMARY
152-
echo "⚠️ This was a dry run. No actual release was created." >> $GITHUB_STEP_SUMMARY
153-
echo "" >> $GITHUB_STEP_SUMMARY
154-
echo "To create a real release:" >> $GITHUB_STEP_SUMMARY
155-
echo "1. Run again with dry_run=false, OR" >> $GITHUB_STEP_SUMMARY
156-
echo "2. Create tag: git tag chart-${{ steps.extract.outputs.chart_name }}-v${{ steps.extract.outputs.version }}" >> $GITHUB_STEP_SUMMARY
157-
158-
- name: Update repository index
159-
if: github.event.inputs.dry_run != 'true'
160-
run: |
161-
echo "Chart ${{ steps.extract.outputs.chart_name }}:${{ steps.extract.outputs.version }} released successfully! 🚀" >> $GITHUB_STEP_SUMMARY
162-
echo "Install with: helm install ${{ steps.extract.outputs.chart_name }} oci://${{ env.REGISTRY }}/${{ github.repository_owner }}/charts/${{ steps.extract.outputs.chart_name }} --version ${{ steps.extract.outputs.version }}" >> $GITHUB_STEP_SUMMARY
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "$GITHUB_ACTOR"
22+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
23+
24+
- name: Install Helm
25+
uses: azure/setup-helm@v3
26+
27+
- name: Run chart-releaser
28+
uses: helm/chart-releaser-action@v1.6.0
29+
with:
30+
skip_existing: true
31+
packages_with_index: true
32+
env:
33+
CR_TOKEN: "${{ secrets.GH_TOKEN }}"

0 commit comments

Comments
 (0)