@@ -33,22 +33,25 @@ jobs:
3333 run : |
3434 case ${{ github.event_name }} in
3535 release)
36- VERSION ="${{ github.event.release.tag_name }}"
37- yarn version --no-git-tag-version --new-version "${VERSION #v}"
36+ TAG ="${{ github.event.release.tag_name }}"
37+ yarn version --no-git-tag-version --new-version "${TAG #v}"
3838 ;;
3939 pull_request)
40- VERSION =$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
40+ DESCRIBE =$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
4141 QUALIFIER=$(git describe --tags | grep -Eo '\-g[0-9a-f]+$')
42- yarn version -s --no-git-tag-version --new-version "${VERSION #v}"
42+ yarn version -s --no-git-tag-version --new-version "${DESCRIBE #v}"
4343 yarn version --no-git-tag-version --prepatch --preid "pr${{ github.event.number }}${QUALIFIER}"
4444 ;;
4545 *)
46- VERSION =$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
46+ DESCRIBE =$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
4747 QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$')
48- yarn version -s --no-git-tag-version --new-version "${VERSION #v}"
48+ yarn version -s --no-git-tag-version --new-version "${DESCRIBE #v}"
4949 yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}${QUALIFIER}"
5050 ;;
5151 esac
52+ VERSION="$(jq -r ".version" < package.json)"
53+ sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
54+ echo "Version is ${VERSION}"
5255
5356 - name : Build
5457 env :
@@ -63,10 +66,21 @@ jobs:
6366 with :
6467 name : dist
6568 path : |
69+ ./CHANGELOG.md
6670 ./package.json
6771 ./dist
6872 retention-days : 1
6973
74+ - name : Commit changelog
75+ if : github.event_name == 'release'
76+ run : |
77+ sed -i '3i ## Unreleased\n' CHANGELOG.md
78+ git config user.name github-actions
79+ git config user.email [email protected] 80+ git add CHANGELOG.md
81+ git commit -m "Update CHANGELOG.md after release [skip ci]"
82+ git push
83+
7084 package :
7185 name : Package
7286 runs-on : [ubuntu-latest]
0 commit comments