changelog #5
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: "changelog" | |
on: | |
schedule: | |
# At 12:00 on day-of-month 1 and 15. | |
- cron: '0 12 1,15 * *' | |
workflow_dispatch: | |
jobs: | |
Publish_Changelog: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: fregante/setup-git-user@v1 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3.7 | |
pip3 install requests | |
- name: Generate changelog | |
run: | | |
# https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types | |
python3 tools/generate_changelog.py ci ${{ github.repository }} | |
cat changelog-$(date +'%Y-%m-%d').md | |
- name: Capture date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Git stash changes | |
run: | | |
git stash --include-untracked | |
- name: Git checkout website branch | |
run: | | |
git checkout website | |
git pull | |
- name: Git stash pop changes | |
run: | | |
git stash pop | |
- name: Copy changelog in changelogs folder | |
run: | | |
cp changelog-* changelogs/ | |
- name: Copy changelog in docs folder | |
run: | | |
cp changelog-* docs/changelog.md | |
- name: Git stage changes | |
run: | | |
git stage changelogs/changelog* | |
git stage docs/changelog* | |
- name: Git commit changes | |
run: | | |
git commit -m "[changelog] Add changelog-${{ steps.date.outputs.date }}.md, update website changelog" | |
- name: Git push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: website | |
force: true |