diff --git a/.gitea/workflows/helm-release.yml b/.gitea/workflows/helm-release.yml index b9ebd18..6c7c5ba 100644 --- a/.gitea/workflows/helm-release.yml +++ b/.gitea/workflows/helm-release.yml @@ -32,26 +32,28 @@ jobs: VERSION="${{ github.event.inputs.version }}" else # Extract version from tag (remove 'v' prefix) - VERSION=${GITHUB_REF#refs/tags/v} + VERSION=${GITEA_REF_NAME#v} fi - echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + echo "VERSION=${VERSION}" + # Export for subsequent steps + echo "VERSION=${VERSION}" >> $GITHUB_ENV echo "📌 Chart version: ${VERSION}" - name: Update Chart version run: | # Update Chart.yaml with the new version - sed -i "s/^version:.*/version: ${{ steps.version.outputs.VERSION }}/" helm/api7ee/Chart.yaml + sed -i "s/^version:.*/version: ${VERSION}/" helm/api7ee/Chart.yaml # Update appVersion to match - sed -i "s/^appVersion:.*/appVersion: \"${{ steps.version.outputs.VERSION }}\"/" helm/api7ee/Chart.yaml + sed -i "s/^appVersion:.*/appVersion: \"${VERSION}\"/" helm/api7ee/Chart.yaml # Update image tags in values.yaml to use this version - sed -i "s|tag: \"main\"|tag: \"v${{ steps.version.outputs.VERSION }}\"|g" helm/api7ee/values.yaml + sed -i "s|tag: \"main\"|tag: \"v${VERSION}\"|g" helm/api7ee/values.yaml # Update registry to Gitea URL sed -i "s|registry: gitea.server_url|registry: ${{ gitea.server_url }}|g" helm/api7ee/values.yaml - echo "📝 Updated Chart.yaml and values.yaml with version ${{ steps.version.outputs.VERSION }}" + echo "📝 Updated Chart.yaml and values.yaml with version ${VERSION}" - name: Lint Helm chart run: | @@ -59,12 +61,12 @@ jobs: - name: Package Helm chart run: | - helm package helm/api7ee/ --version ${{ steps.version.outputs.VERSION }} - echo "CHART_FILE=api7ee-${{ steps.version.outputs.VERSION }}.tgz" >> $GITHUB_ENV + helm package helm/api7ee/ --version ${VERSION} + echo "CHART_FILE=api7ee-${VERSION}.tgz" >> $GITHUB_ENV # Generate chart README with installation instructions cat > CHART_README.md << EOF - # API7 Enterprise Edition Helm Chart v${{ steps.version.outputs.VERSION }} + # API7 Enterprise Edition Helm Chart v${VERSION} ## Installation @@ -74,23 +76,23 @@ jobs: helm repo update # Install the chart - helm install my-api7ee api7ee/api7ee --version ${{ steps.version.outputs.VERSION }} + helm install my-api7ee api7ee/api7ee --version ${VERSION} # Install with custom values - helm install my-api7ee api7ee/api7ee --version ${{ steps.version.outputs.VERSION }} -f values.yaml + helm install my-api7ee api7ee/api7ee --version ${VERSION} -f values.yaml \`\`\` ## Upgrade \`\`\`bash - helm upgrade my-api7ee api7ee/api7ee --version ${{ steps.version.outputs.VERSION }} + helm upgrade my-api7ee api7ee/api7ee --version ${VERSION} \`\`\` ## Docker Images This chart uses the following Docker images: - - Web: \`${{ gitea.server_url }}/${{ gitea.repository }}/web:v${{ steps.version.outputs.VERSION }}\` - - API: \`${{ gitea.server_url }}/${{ gitea.repository }}/api:v${{ steps.version.outputs.VERSION }}\` + - Web: \`${{ gitea.server_url }}/${{ gitea.repository }}/web:v${VERSION}\` + - API: \`${{ gitea.server_url }}/${{ gitea.repository }}/api:v${VERSION}\` EOF - name: Push Helm chart to Gitea Package Registry @@ -102,46 +104,68 @@ jobs: -F "chart=@${CHART_FILE}" \ https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm/api/charts - echo "✅ Helm chart v${{ steps.version.outputs.VERSION }} pushed to Gitea Package Registry" + echo "✅ Helm chart v${VERSION} pushed to Gitea Package Registry" - name: Create Release - uses: softprops/action-gh-release@v1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - with: - files: | - ${{ env.CHART_FILE }} - CHART_README.md - generate_release_notes: true - body: | - ## Helm Chart Release v${{ steps.version.outputs.VERSION }} + run: | + # Create release using Gitea API + RELEASE_DATA=$(cat <> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "- **Version:** v${{ steps.version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY - echo "- **Chart:** ${CHART_FILE}" >> $GITHUB_STEP_SUMMARY - echo "- **Registry:** https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Installation Commands" >> $GITHUB_STEP_SUMMARY - echo '```bash' >> $GITHUB_STEP_SUMMARY - echo "helm repo add api7ee https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm" >> $GITHUB_STEP_SUMMARY - echo "helm repo update" >> $GITHUB_STEP_SUMMARY - echo "helm install my-api7ee api7ee/api7ee --version ${{ steps.version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY \ No newline at end of file + echo "## 🎉 Helm Chart Release Summary" + echo "" + echo "- **Version:** v${VERSION}" + echo "- **Chart:** ${CHART_FILE}" + echo "- **Registry:** https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm" + echo "" + echo "### Installation Commands" + echo '```bash' + echo "helm repo add api7ee https://${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/helm" + echo "helm repo update" + echo "helm install my-api7ee api7ee/api7ee --version ${VERSION}" + echo '```' \ No newline at end of file