Consolidate all Helm build and release tasks into single workflow
- Removed build-helm job from build.yml (Docker builds only now) - Created comprehensive helm-release.yml that handles: - Development builds on main branch pushes (with dev suffix) - Release builds on version tags (v*.*.*) - Manual releases via workflow_dispatch - PR linting without publishing - Added intelligent version detection: - Development versions get timestamp suffix - Release versions use clean semver - Manual dispatch can specify custom version - Improved release process with proper Gitea API integration - Added conditional release creation only for tagged versions - Updated README to document the new workflow structure - Separated concerns: build.yml for Docker, helm-release.yml for Helm
This commit is contained in:
@@ -79,67 +79,3 @@ jobs:
|
||||
labels: ${{ steps.meta-api.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ vars.PACKAGES_REGISTRY || gitea.server_url }}/${{ gitea.repository }}/api:buildcache
|
||||
cache-to: type=registry,ref=${{ vars.PACKAGES_REGISTRY || gitea.server_url }}/${{ gitea.repository }}/api:buildcache,mode=max
|
||||
|
||||
build-helm:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-web, build-api]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for proper versioning
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v3
|
||||
with:
|
||||
version: "latest"
|
||||
|
||||
- name: Lint Helm chart
|
||||
run: |
|
||||
helm lint helm/api7ee-demo-k8s/
|
||||
|
||||
- name: Package Helm chart
|
||||
run: |
|
||||
# Get version from Chart.yaml
|
||||
CHART_VERSION=$(grep '^version:' helm/api7ee-demo-k8s/Chart.yaml | awk '{print $2}')
|
||||
echo "Chart version: ${CHART_VERSION}"
|
||||
|
||||
# Create a temporary copy of the chart for packaging
|
||||
cp -r helm/api7ee-demo-k8s /tmp/api7ee-demo-k8s-chart
|
||||
|
||||
# Update image registry and repository in the copy's values.yaml
|
||||
sed -i "s|registry: gitea.server_url|registry: ${{ gitea.server_url }}|g" /tmp/api7ee-demo-k8s-chart/values.yaml
|
||||
sed -i "s|repository: gitea.repository/|repository: ${{ gitea.repository }}/|g" /tmp/api7ee-demo-k8s-chart/values.yaml
|
||||
|
||||
# Package the modified chart
|
||||
helm package /tmp/api7ee-demo-k8s-chart --version ${CHART_VERSION}
|
||||
|
||||
# Store chart filename for later use
|
||||
echo "CHART_FILE=api7ee-demo-k8s-${CHART_VERSION}.tgz" >> $GITHUB_ENV
|
||||
|
||||
- name: Push Helm chart to Gitea Package Registry
|
||||
run: |
|
||||
# Upload Helm chart to Gitea package registry
|
||||
# Format: https://{gitea-server}/api/packages/{owner}/helm/api/charts
|
||||
curl --fail-with-body \
|
||||
-H "Authorization: token ${{ secrets.PACKAGES_PUSH_TOKEN }}" \
|
||||
-X POST \
|
||||
-F "chart=@${CHART_FILE}" \
|
||||
https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm/api/charts
|
||||
|
||||
echo "✅ Helm chart pushed successfully to Gitea Package Registry"
|
||||
echo "📦 Chart: ${CHART_FILE}"
|
||||
echo "🔗 Registry URL: https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm"
|
||||
|
||||
- name: Create Helm index
|
||||
if: success()
|
||||
run: |
|
||||
# Create or update the Helm repository index
|
||||
echo "📝 Helm chart repository information:"
|
||||
echo "To add this repository:"
|
||||
echo " helm repo add api7ee https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm"
|
||||
echo " helm repo update"
|
||||
echo ""
|
||||
echo "To install the chart:"
|
||||
echo " helm install my-api7ee api7ee/api7ee-demo-k8s"
|
||||
|
||||
Reference in New Issue
Block a user