From 5da23def5bba013d61fda6b38cca77f4e5bef7ee Mon Sep 17 00:00:00 2001 From: DevContainer User Date: Sat, 21 Feb 2026 21:17:37 +0000 Subject: [PATCH] fix: add automatic release workflow for tag-based releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Triggers on tag pushes (v*) to create GitHub releases - Publishes Helm chart to OCI registry - Generates release notes with commit history - Complements existing build-and-push workflow Now releases are fully automated: 1. Push tag → build-and-push.yaml builds Docker images 2. Push tag → release.yaml creates GitHub release + publishes Helm chart Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .github/workflows/release.yaml | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5d8e416 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,86 @@ +name: Release + +on: + push: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4 + + - name: Extract version from tag + id: version + run: | + TAG=${GITHUB_REF#refs/tags/} + VERSION=${TAG#v} + echo "tag=${TAG}" >> $GITHUB_OUTPUT + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "🚀 Creating release for ${TAG}" + + - name: Package and Push Helm Chart + run: | + helm registry login ghcr.io \ + --username ${{ github.actor }} \ + --password ${{ secrets.GITHUB_TOKEN }} + helm package chart/ + helm push devcontainer-${{ steps.version.outputs.version }}.tgz oci://ghcr.io/cpfarhood/charts + + - name: Generate Release Notes + id: notes + run: | + # Get commits since last tag + PREV_TAG=$(git describe --tags --abbrev=0 ${{ steps.version.outputs.tag }}^ 2>/dev/null || echo "") + if [ -z "$PREV_TAG" ]; then + COMMITS=$(git log --pretty=format:"- %s (%h)" ${{ steps.version.outputs.tag }}) + else + COMMITS=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..${{ steps.version.outputs.tag }}) + fi + + cat << EOF > release-notes.md + ## 🚀 Release ${{ steps.version.outputs.version }} + + ### Changes + ${COMMITS} + + ### Docker Image + \`\`\`bash + docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }} + \`\`\` + + ### Helm Chart + \`\`\`bash + helm install devcontainer oci://ghcr.io/cpfarhood/charts/devcontainer --version ${{ steps.version.outputs.version }} + \`\`\` + EOF + + echo "notes<> $GITHUB_OUTPUT + cat release-notes.md >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.version.outputs.tag }} + release_name: Release ${{ steps.version.outputs.tag }} + body: ${{ steps.notes.outputs.notes }} + draft: false + prerelease: false \ No newline at end of file