Initialize changelog files #424
Workflow file for this run
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: 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 }} |