From 663106800d421f4b2f673d77f6e6f63589924ba5 Mon Sep 17 00:00:00 2001 From: Hovig Date: Thu, 5 Sep 2024 15:52:53 +0200 Subject: [PATCH] add changelog action --- .github/workflows/changelog.yml | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/changelog.yml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..d7567ac8 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,35 @@ +name: Update Changelog +on: + # Runs whenever a new tag is pushed + push: + tags: + - '*.*.*' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + # Update Changelog job + publish: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Update Changelogs + run: | + changelogs=("$(find "connectors" -type f -name "CHANGELOG.md")") + version=$GITHUB_REF_NAME + date=$(date +"%Y-%m-%d") + + for changelog in ${changelogs[*]} + do + echo "$changelog" + # Replace the line containing "## Unreleased" with new version and date + sed -i -e "s/^## Unreleased$/## [$v] - $date/" "$changelog" + done + - name: Commit Changelogs + run: | + git add connectors/**/CHANGELOG.md + git commit -m "update CHANGELOG.md" + git push \ No newline at end of file