Update CHANGELOG.md #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update CHANGELOG.md | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to document in the changelog (unreleased, current, 0.7.0)' | |
required: true | |
default: 'current' | |
workflow_run: | |
workflows: [Release NPM packages] | |
types: | |
- completed | |
jobs: | |
release: | |
# Only run this workflow from the trunk branch and when it's triggered by dmsnell OR adamziel | |
if: > | |
github.ref == 'refs/heads/trunk' && ( | |
github.event.workflow_run.conclusion == 'success' || | |
github.actor == 'adamziel' || | |
github.actor == 'dmsnell' || | |
github.actor == 'bgrgicak' || | |
github.actor == 'brandonpayton' | |
) | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
environment: | |
name: wordpress-assets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
ref: trunk | |
clean: true | |
persist-credentials: false | |
- name: Fetch trunk | |
shell: bash | |
run: git fetch origin trunk --depth=1 --recurse-submodules | |
- name: 'Install bun (for the changelog)' | |
run: | | |
curl -fsSL https://bun.sh/install | bash | |
- name: '✏️ Generate release changelog' | |
run: | | |
ls ./ | |
if [ -z "${{ inputs.version }}" ]; then | |
VERSION=current | |
else | |
VERSION=${{ inputs.version }} | |
fi | |
PATH="${PATH}:${HOME}/.bun/bin" npm run changelog -- --version=$VERSION | |
PATH="${PATH}:${HOME}/.bun/bin" bun packages/docs/site/bin/refresh-changelog.ts | |
- name: '📦 Commit and push changelog' | |
run: | | |
git config --global user.name "deployment_bot" | |
git config --global user.email "[email protected]" | |
git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} | |
if [[ -n $(git status --porcelain CHANGELOG.md) ]]; then | |
git commit -m "chore: update changelog" \ | |
CHANGELOG.md \ | |
packages/docs/site/docs/*changelog*.md | |
git pull origin trunk --rebase | |
git push origin trunk | |
else | |
echo "No changes in CHANGELOG.md. Skipping commit and push." | |
fi |