-
Notifications
You must be signed in to change notification settings - Fork 258
68 lines (65 loc) · 2.68 KB
/
update-changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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@v3
with:
ref: trunk
clean: true
persist-credentials: false
- name: Fetch trunk
shell: bash
run: git fetch origin trunk --depth=1
- 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 "deployment_bot@users.noreply.github.com"
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