Skip to content

Commit cc2dcee

Browse files
committed
Add Github actions
1 parent 57b5e89 commit cc2dcee

File tree

5 files changed

+200
-2
lines changed

5 files changed

+200
-2
lines changed

.github/workflows/release.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release Helm Chart
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- values.yaml
9+
- Chart.yaml
10+
- templates/**
11+
12+
jobs:
13+
release:
14+
runs-on: org
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-dpth: 0
20+
fetch-tags: true
21+
22+
- name: Configure Git
23+
run: |
24+
git config --global user.name 'Github Actions (${{ github.actor }})'
25+
git config --global user.email '[email protected]'
26+
27+
- name: Run chart-releaser
28+
uses: bitdeps/[email protected]
29+
with:
30+
charts_dir: .
31+
oci_registry: ghcr.io/comet-ml
32+
oci_username: github-actions
33+
oci_password: ${{ secrets.GITHUB_TOKEN }}
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Verify Chart Version Update
2+
run-name: Verify Chart Version Update for PR #${{ github.event.number }} by @${{ github.actor }}
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
paths:
9+
- values.yaml
10+
- Chart.yaml
11+
- templates/**
12+
13+
jobs:
14+
verify-version:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 5
17+
18+
steps:
19+
- name: Checkout PR branch
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
fetch-tags: true
24+
25+
- name: Get current chart version
26+
id: current_version
27+
run: |
28+
CURRENT_VERSION=$(yq '.version' Chart.yaml)
29+
echo "Current Chart version: $CURRENT_VERSION"
30+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
31+
32+
- name: Get latest release version
33+
id: latest_release
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
# Use GitHub API to get the latest release
38+
echo "Fetching latest GitHub release..."
39+
40+
# Get the latest release using GitHub CLI (pre-installed in GitHub Actions)
41+
RELEASE_INFO=$(gh api repos/${{ github.repository }}/releases/latest 2>/dev/null || echo "")
42+
43+
if [ -z "$RELEASE_INFO" ]
44+
then
45+
echo "No previous GitHub release found. Skipping version check."
46+
echo "has_release=false" >> $GITHUB_OUTPUT
47+
exit 0
48+
fi
49+
50+
# Extract the tag name from the release
51+
LATEST_TAG=$(echo "$RELEASE_INFO" | jq -r '.tag_name')
52+
53+
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]
54+
then
55+
echo "No tag found in latest release. Skipping version check."
56+
echo "has_release=false" >> $GITHUB_OUTPUT
57+
exit 0
58+
fi
59+
60+
echo "Latest release tag: $LATEST_TAG"
61+
62+
# Checkout the release tag to get its Chart.yaml
63+
git checkout "$LATEST_TAG" -- Chart.yaml 2>/dev/null || {
64+
echo "Could not find Chart.yaml in release $LATEST_TAG"
65+
echo "has_release=false" >> $GITHUB_OUTPUT
66+
exit 0
67+
}
68+
69+
# Get the version from the released Chart.yaml
70+
RELEASE_VERSION=$(yq '.version' Chart.yaml)
71+
echo "Release Chart version: $RELEASE_VERSION"
72+
echo "version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
73+
echo "has_release=true" >> $GITHUB_OUTPUT
74+
75+
# Restore the PR's Chart.yaml
76+
git checkout HEAD -- Chart.yaml
77+
78+
- name: Install semver comparison tool
79+
if: steps.latest_release.outputs.has_release == 'true'
80+
run: |
81+
# Install Node.js semver tool for accurate version comparison
82+
npm install -g semver
83+
84+
- name: Compare versions
85+
if: steps.latest_release.outputs.has_release == 'true'
86+
run: |
87+
CURRENT_VERSION="${{ steps.current_version.outputs.version }}"
88+
RELEASE_VERSION="${{ steps.latest_release.outputs.version }}"
89+
90+
echo "Comparing versions:"
91+
echo " Current version: $CURRENT_VERSION"
92+
echo " Release version: $RELEASE_VERSION"
93+
94+
# Check if current version is valid semantic version
95+
if ! semver "$CURRENT_VERSION" >/dev/null 2>&1
96+
then
97+
echo "❌ Error: Current version '$CURRENT_VERSION' is not a valid semantic version"
98+
exit 1
99+
fi
100+
101+
# Check if release version is valid semantic version
102+
if ! semver "$RELEASE_VERSION" >/dev/null 2>&1
103+
then
104+
echo "❌ Error: Release version '$RELEASE_VERSION' is not a valid semantic version"
105+
exit 1
106+
fi
107+
108+
# Compare versions - current should be greater than release
109+
if semver "$CURRENT_VERSION" -r ">$RELEASE_VERSION"
110+
then
111+
echo "✅ Version has been properly incremented from $RELEASE_VERSION to $CURRENT_VERSION"
112+
else
113+
echo "❌ Error: Chart version has not been incremented!"
114+
echo " The current version ($CURRENT_VERSION) must be greater than the released version ($RELEASE_VERSION)"
115+
echo ""
116+
echo "Please update the 'version' field in Chart.yaml to a version higher than $RELEASE_VERSION"
117+
echo "Following semantic versioning rules (MAJOR.MINOR.PATCH):"
118+
echo " - MAJOR: incompatible API changes"
119+
echo " - MINOR: backwards-compatible functionality additions"
120+
echo " - PATCH: backwards-compatible bug fixes"
121+
exit 1
122+
fi
123+
124+
- name: Version check summary
125+
if: always()
126+
run: |
127+
# Write to GitHub workflow summary
128+
if [ "${{ steps.latest_release.outputs.has_release }}" != "true" ]
129+
then
130+
echo "## 📋 Chart Version Check Summary" >> $GITHUB_STEP_SUMMARY
131+
echo "" >> $GITHUB_STEP_SUMMARY
132+
echo "✅ **Status:** No previous GitHub release found - version check skipped" >> $GITHUB_STEP_SUMMARY
133+
echo "" >> $GITHUB_STEP_SUMMARY
134+
echo "ℹ️ This is the first release, so no version comparison was performed." >> $GITHUB_STEP_SUMMARY
135+
elif [ "${{ job.status }}" == "success" ]
136+
then
137+
echo "## 📋 Chart Version Check Summary" >> $GITHUB_STEP_SUMMARY
138+
echo "" >> $GITHUB_STEP_SUMMARY
139+
echo "✅ **Status:** Chart version has been properly updated" >> $GITHUB_STEP_SUMMARY
140+
echo "" >> $GITHUB_STEP_SUMMARY
141+
echo "| Version Type | Value |" >> $GITHUB_STEP_SUMMARY
142+
echo "|--------------|-------|" >> $GITHUB_STEP_SUMMARY
143+
echo "| Previous Release | ${{ steps.latest_release.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
144+
echo "| Current PR | ${{ steps.current_version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
145+
else
146+
echo "## 📋 Chart Version Check Summary" >> $GITHUB_STEP_SUMMARY
147+
echo "" >> $GITHUB_STEP_SUMMARY
148+
echo "❌ **Status:** Chart version needs to be incremented" >> $GITHUB_STEP_SUMMARY
149+
echo "" >> $GITHUB_STEP_SUMMARY
150+
echo "| Version Type | Value |" >> $GITHUB_STEP_SUMMARY
151+
echo "|--------------|-------|" >> $GITHUB_STEP_SUMMARY
152+
echo "| Previous Release | ${{ steps.latest_release.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
153+
echo "| Current PR | ${{ steps.current_version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
echo "### Required Action" >> $GITHUB_STEP_SUMMARY
156+
echo "Please update the \`version\` field in Chart.yaml to a version higher than **${{ steps.latest_release.outputs.version }}**" >> $GITHUB_STEP_SUMMARY
157+
echo "" >> $GITHUB_STEP_SUMMARY
158+
echo "Following semantic versioning rules:" >> $GITHUB_STEP_SUMMARY
159+
echo "- **MAJOR:** incompatible API changes" >> $GITHUB_STEP_SUMMARY
160+
echo "- **MINOR:** backwards-compatible functionality additions" >> $GITHUB_STEP_SUMMARY
161+
echo "- **PATCH:** backwards-compatible bug fixes" >> $GITHUB_STEP_SUMMARY
162+
fi

.helmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
.idea/
2222
*.tmproj
2323
.vscode/
24+
25+
README.md.gotmpl

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.0.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# s3proxy
22

3-
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.7.0](https://img.shields.io/badge/AppVersion-2.7.0-informational?style=flat-square)
3+
![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.7.0](https://img.shields.io/badge/AppVersion-2.7.0-informational?style=flat-square)
44

55
A Helm chart for deploying S3Proxy - Access other storage backends via the S3 API
66

0 commit comments

Comments
 (0)