Skip to content

Commit

Permalink
chore: Add changelog script
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Oct 21, 2021
1 parent 0851b40 commit 00fcbe9
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/generate-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Generate Changelog'

on:
push:
tags:
- 'v*'

jobs:
Changelog:
runs-on: ubuntu-latest

steps:
- name: 'Checkout Git repository with history for all branches and tags'
uses: actions/[email protected]
with:
fetch-depth: 0

- name: 'Set current Git tag'
run: echo "CURRENT_TAG=$(git tag --points-at ${{github.sha}})" >> "$GITHUB_ENV"

- name: 'Set previous Git tag'
run: echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 --exclude ${{env.CURRENT_TAG}})" >> "$GITHUB_ENV"

- name: 'Print environment variables'
run: |
echo -e "PREVIOUS_TAG = ${{env.PREVIOUS_TAG}}"
echo -e "CURRENT_TAG = ${{env.CURRENT_TAG}}"
echo -e "Node.js version = $(node --version)"
- name: 'Generate changelog'
run: |
echo "{}" > ./package.json
npx [email protected] -t ${{env.PREVIOUS_TAG}}...${{env.CURRENT_TAG}}
- name: 'Attach changelog to tag'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
tag_name: ${{env.CURRENT_TAG}}
name: ${{env.CURRENT_TAG}}
body_path: ./CHANGELOG.md
draft: false
prerelease: false

0 comments on commit 00fcbe9

Please sign in to comment.