-
Notifications
You must be signed in to change notification settings - Fork 275
54 lines (52 loc) · 2.15 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
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'
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.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 ./
PATH="${PATH}:${HOME}/.bun/bin" npm run changelog -- --version=${{ inputs.version }}
- 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 CHANGELOG.md -m "chore: update changelog"
git pull origin trunk --rebase
git push origin trunk
else
echo "No changes in CHANGELOG.md. Skipping commit and push."
fi