Skip to content

Commit d1f4f72

Browse files
authored
docs: create an automated changlog file that shows up in release files (#1793)
* docs: create an automated changlog file that shows up in release files on merge to develop/ami release success * docs: changelog after release * feat: 1. Version check (.github/workflows/ami-release-nix.yml:110-120): After grabbing the release version, it checks if it matches the pattern ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]{3}(-orioledb)?$ and sets is_release output 2. Generate Changelog (.github/workflows/ami-release-nix.yml:122-125): Only runs if is_release == 'true', uses --unreleased flag to generate changelog for commits since the last tag 3. Commit and push (.github/workflows/ami-release-nix.yml:127-136): Commits the CHANGELOG.md to the repo and captures the new commit SHA 4. Create release (.github/workflows/ami-release-nix.yml:189-195): Uses the changelog commit SHA as the target for releases, or falls back to the original SHA for non-release builds * feat: start of actual changelog * chore: remove extra chars from automated changelog * chore: add base changelog * chore: rm unreleased
1 parent 0e4bbb7 commit d1f4f72

File tree

2 files changed

+2645
-1
lines changed

2 files changed

+2645
-1
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,30 @@ jobs:
112112
run: |
113113
VERSION=$(cat common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
114114
echo "version=$VERSION" >> $GITHUB_OUTPUT
115+
# Check if version matches release pattern
116+
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]{3}(-orioledb)?$'; then
117+
echo "is_release=true" >> $GITHUB_OUTPUT
118+
else
119+
echo "is_release=false" >> $GITHUB_OUTPUT
120+
fi
121+
122+
- name: Generate Changelog
123+
if: steps.process_release_version.outputs.is_release == 'true'
124+
run: |
125+
nix run nixpkgs#git-cliff -- --tag-pattern "^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]{3}(-orioledb)?$" --unreleased --tag "${{ steps.process_release_version.outputs.version }}" --prepend CHANGELOG.md
126+
# Remove the changelog commit itself from the changelog
127+
sed -i '/- Changelog after release/d' CHANGELOG.md
128+
129+
- name: Commit and push changelog
130+
if: steps.process_release_version.outputs.is_release == 'true'
131+
run: |
132+
git config user.name "github-actions[bot]"
133+
git config user.email "github-actions[bot]@users.noreply.github.com"
134+
git add CHANGELOG.md
135+
git commit -m "docs: update changelog for ${{ steps.process_release_version.outputs.version }}"
136+
git push
137+
echo "changelog_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
138+
id: commit_changelog
115139

116140
- name: Create nix flake revision tarball
117141
run: |
@@ -169,7 +193,8 @@ jobs:
169193
with:
170194
name: ${{ steps.process_release_version.outputs.version }}
171195
tag_name: ${{ steps.process_release_version.outputs.version }}
172-
target_commitish: ${{github.sha}}
196+
target_commitish: ${{ steps.process_release_version.outputs.is_release == 'true' && steps.commit_changelog.outputs.changelog_commit || github.sha }}
197+
files: CHANGELOG.md
173198

174199
- name: Slack Notification on Failure
175200
if: ${{ failure() }}

0 commit comments

Comments
 (0)