Skip to content

Commit

Permalink
ci: Generate main changelog after Helm chart release (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardillb authored Jul 5, 2024
2 parents 1295339 + 2441c2b commit 7684cb0
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/helm-chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ jobs:
contents: write
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_APP_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0

- name: Wait for container images build
Expand Down Expand Up @@ -72,3 +80,29 @@ jobs:
charts_dir: helm
config: .github/configs/cr.yaml
skip_existing: true

- name: Update main changelog
if: steps.semantic-release.outputs.new_release_published == 'true'
run: |
releases=$(gh release list --limit 2 --json name)
latest_release_tag=$(echo "$releases" | jq -r '.[0].name')
previous_release_tag=$(echo "$releases" | jq -r '.[1].name')
clean_latest_version=$(echo $latest_release_tag | sed -E 's/v//g')
echo "#### ${clean_latest_version}: Release" >> CHANGELOG.new
echo >> CHANGELOG.new
for logEntry in $(git log --first-parent --merges --abbrev-commit --pretty=oneline $previous_release_tag..$latest_release_tag| sed -E 's/^.*#//g;s/ from.*//g;/Merge branch/d;s/[^0-9]*//g')
do
echo " - "$(gh pr view $logEntry --json title,number,author -t "{{.title}} (#{{.number}}) @{{.author.login}}") >> CHANGELOG.new
done
echo >> CHANGELOG.new
if [ -e CHANGELOG.md ]
then
cat CHANGELOG.md >> CHANGELOG.new
fi
mv CHANGELOG.new CHANGELOG.md
git config --global user.name "GitHub Actions Bot"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "Update CHANGELOG for $clean_latest_version [no ci]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7684cb0

Please sign in to comment.