From 7ca1744168c6b7130ef1493eb96b75d5ac9fb78c Mon Sep 17 00:00:00 2001 From: Doh Date: Fri, 17 Jan 2025 16:17:57 -0500 Subject: [PATCH] action to auto cut github release (#43) --- .github/workflows/docker-publish.yml | 27 +++++++++++++++++++++++++++ CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f656d42..b5b5692 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest outputs: EXISTS: ${{ steps.check-version.outputs.EXISTS }} + VERSION: ${{ steps.package-version.outputs.VERSION }} steps: - name: Checkout code @@ -66,3 +67,29 @@ jobs: KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} with: args: rollout restart -n ${{ secrets.KUBE_NAMESPACE }} deploy/${{ secrets.KUBE_DEPLOYMENT }} + + create-release: + runs-on: ubuntu-latest + needs: build-and-push + if: needs.build-and-push.outputs.EXISTS == 'false' + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create GitHub release + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + VERSION: ${{ needs.build-and-push.outputs.VERSION }} + run: | + # Extract release notes from CHANGELOG.md + notes=$(awk -v version="$VERSION" ' + $0 ~ "## Version " version {flag=1;next} + $0 ~ "## Version " && flag {exit} + flag' CHANGELOG.md) + + gh release create "v$VERSION" \ + --repo="$GITHUB_REPOSITORY" \ + --title="v$VERSION" \ + --notes="$notes" diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa0f04..bc86150 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Version 0.1.21 + +### Added + +- auto cut github release for new version + ## Version 0.1.20 ### Changed diff --git a/package.json b/package.json index c17ccc4..85015a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "habittrove", - "version": "0.1.20", + "version": "0.1.21", "private": true, "scripts": { "dev": "next dev --turbopack",