-
Notifications
You must be signed in to change notification settings - Fork 72
43 lines (36 loc) · 1.58 KB
/
init-changelogs.yaml
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
name: Initialize changelog files
on: create
jobs:
changelogs:
if: >-
${{ startsWith(github.ref, 'refs/heads/hotfix/v') ||
startsWith(github.ref, 'refs/heads/release/v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PUSH_TOKEN }}
- name: Set version
run: |
REF="${{ github.ref }}"
echo "VERSION=${REF#*/v}" >> $GITHUB_ENV
- name: Create changelogs
run: |
CHANGES_WIN=win-linux/package/windows/update/changes
CHANGES_MAC=macos/ONLYOFFICE/update/updates/ONLYOFFICE/changes
CHANGES_LINUX=common/changes
rm -rfv $CHANGES_WIN/$VERSION $CHANGES_MAC/$VERSION $CHANGES_LINUX/$VERSION
cp -fRTv $CHANGES_WIN/0.0.0 $CHANGES_WIN/$VERSION
cp -fRTv $CHANGES_MAC/0.0.0 $CHANGES_MAC/$VERSION
cp -fRTv $CHANGES_LINUX/template $CHANGES_LINUX/$VERSION
# for changelog files for win, mac and linux replace '0.0.0' with VERSION,
# and replace '000' in the row included 'CHANGELOG' with VERSION without dots
find $CHANGES_WIN/$VERSION $CHANGES_MAC/$VERSION $CHANGES_LINUX/$VERSION -name "*.html" -print \
-exec sed -e 's/0.0.0/'${VERSION}'/g' -e '/CHANGELOG/s/000/'${VERSION//./}'/g' -i {} \;
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: Initialize changelogs for v${{ env.VERSION }}