From 9ca30600b76c424e2f1748b211c6f03096a0042f Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sun, 8 Dec 2024 14:32:00 +0100 Subject: [PATCH] added automatic release creation --- .github/workflows/pipeline.yaml | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml index b41de62..5310135 100644 --- a/.github/workflows/pipeline.yaml +++ b/.github/workflows/pipeline.yaml @@ -137,4 +137,42 @@ jobs: git commit -m "Update Helm chart repository" git push + create-release: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Generate Release Notes + id: release_notes + run: | + # Get previous tag + prev_tag=$(git describe --tags --abbrev=0 ${{ github.ref_name }}^ 2>/dev/null || echo "") + + echo "### Release ${{ github.ref_name }}" > release_notes.md + echo "" >> release_notes.md + + # Get all commits between tags + if [ -z "$prev_tag" ]; then + echo "### 🔄 All Commits" >> release_notes.md + git log --pretty=format:"* %h - %s (%an)%n%w(4,4,4)%b" >> release_notes.md + else + echo "### 🔄 Commits since $prev_tag" >> release_notes.md + git log --pretty=format:"* %h - %s (%an)%n%w(4,4,4)%b" $prev_tag..${{ steps.tag.outputs.tag }} >> release_notes.md + fi + + echo "" >> release_notes.md + echo "" >> release_notes.md + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + body_path: release_notes.md + token: ${{ github.token }} +