Files
nhost/.github/workflows/ci_update_changelog.yaml

74 lines
2.3 KiB
YAML

---
name: "ci: update changelog"
on:
push:
branches:
- main
jobs:
update-changelog:
if: ${{ !startsWith(github.event.head_commit.message, 'release(') }}
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 30
strategy:
matrix:
project: [cli, dashboard, packages/nhost-js, services/auth, services/storage]
permissions:
id-token: write
contents: write
pull-requests: write
actions: write
steps:
- name: "Check out repository"
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Nix with Cache
uses: ./.github/actions/setup-nix
with:
NAME: ${{ inputs.NAME }}
NIX_CACHE_PUB_KEY: ${{ secrets.NIX_CACHE_PUB_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Get next version"
id: version
run: |
cd ${{ matrix.project }}
TAG_NAME=$(make release-tag-name)
VERSION=$(nix develop .\#cliff -c make changelog-next-version)
if git tag | grep -qx "$TAG_NAME@$VERSION"; then
echo "Tag $TAG_NAME@$VERSION already exists, skipping release preparation"
else
echo "Tag $TAG_NAME@$VERSION does not exist, proceeding with release preparation"
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
- name: "Update changelog"
if: steps.version.outputs.version != ''
run: |
cd ${{ matrix.project }}
nix develop .\#cliff -c make changelog-update
- name: "Create Pull Request"
if: steps.version.outputs.version != ''
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "release(${{ matrix.project }}): ${{ steps.version.outputs.version }}"
title: "release(${{ matrix.project }}): ${{ steps.version.outputs.version }}"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: |
Automated release preparation for ${{ matrix.project }} version ${{ steps.version.outputs.version }}
Changes:
- Updated CHANGELOG.md
branch: release/${{ matrix.project }}
delete-branch: true
labels: |
release,${{ matrix.project }}