Skip to content

Commit 0aff8f2

Browse files
committed
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
1 parent 7a3290f commit 0aff8f2

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,28 @@ 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 }}" -o CHANGELOG.md
126+
127+
- name: Commit and push changelog
128+
if: steps.process_release_version.outputs.is_release == 'true'
129+
run: |
130+
git config user.name "github-actions[bot]"
131+
git config user.email "github-actions[bot]@users.noreply.github.com"
132+
git add CHANGELOG.md
133+
git commit -m "docs: update changelog for ${{ steps.process_release_version.outputs.version }}"
134+
git push
135+
echo "changelog_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
136+
id: commit_changelog
115137

116138
- name: Create nix flake revision tarball
117139
run: |
@@ -169,13 +191,9 @@ jobs:
169191
with:
170192
name: ${{ steps.process_release_version.outputs.version }}
171193
tag_name: ${{ steps.process_release_version.outputs.version }}
172-
target_commitish: ${{github.sha}}
194+
target_commitish: ${{ steps.process_release_version.outputs.is_release == 'true' && steps.commit_changelog.outputs.changelog_commit || github.sha }}
173195
files: CHANGELOG.md
174196

175-
- name: Generate Changelog
176-
run: |
177-
nix run nixpkgs#git-cliff -- --tag-pattern "^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]{3}(-orioledb)?$" --tag "$(git describe --tags --abbrev=0)" -o CHANGELOG.md
178-
179197
- name: Slack Notification on Failure
180198
if: ${{ failure() }}
181199
uses: rtCamp/action-slack-notify@v2

0 commit comments

Comments
 (0)