|
14 | 14 | - 'v*' |
15 | 15 |
|
16 | 16 | jobs: |
| 17 | + update_changelog: |
| 18 | + name: Update Changelog |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + ref: master |
| 26 | + |
| 27 | + - name: Get new tag |
| 28 | + id: newversion |
| 29 | + run: | |
| 30 | + tag=${GITHUB_REF/refs\/tags\//} |
| 31 | + version=$(echo $tag | sed 's/-rc[0-9]*//') |
| 32 | + if [[ $tag != *"-rc"* ]]; then |
| 33 | + echo "do_changelog=1" >> $GITHUB_ENV |
| 34 | + echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT |
| 35 | + echo "version=$(echo $version)" >> $GITHUB_OUTPUT |
| 36 | + fi |
| 37 | + echo "New tag is: $tag" |
| 38 | + echo "New version is: $version" |
| 39 | + echo "GitHub ref: ${{ github.ref }}" |
| 40 | +
|
| 41 | + - name: Generate release changelog |
| 42 | + uses: heinrichreimer/github-changelog-generator-action@master |
| 43 | + if: ${{ env.do_changelog == 1 }} |
| 44 | + with: |
| 45 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + sinceTag: "v1.3.1" |
| 47 | + excludeTagsRegex: "-rc[0-9]" |
| 48 | + breakingLabel: "Breaking Changes" |
| 49 | + breakingLabels: "V: major" |
| 50 | + enhancementLabel: "Features" |
| 51 | + enhancementLabels: "P: enhancement" |
| 52 | + bugsLabel: "Bug Fixes" |
| 53 | + bugLabels: "P: bug" |
| 54 | + excludeLabels: "release" |
| 55 | + issues: false |
| 56 | + issuesWoLabels: false |
| 57 | + maxIssues: 100 |
| 58 | + pullRequests: true |
| 59 | + prWoLabels: false |
| 60 | + author: true |
| 61 | + unreleased: true |
| 62 | + compareLink: true |
| 63 | + stripGeneratorNotice: true |
| 64 | + verbose: true |
| 65 | + |
| 66 | + - name: Check if diff |
| 67 | + if: ${{ env.do_changelog == 1 }} |
| 68 | + continue-on-error: true |
| 69 | + run: > |
| 70 | + git diff --exit-code CHANGELOG.md && |
| 71 | + (echo "### No update" && exit 1) || (echo "### Commit update") |
| 72 | +
|
| 73 | + - uses: EndBug/add-and-commit@v9 |
| 74 | + name: Commit and push if diff |
| 75 | + if: ${{ env.do_changelog == 1 }} |
| 76 | + with: |
| 77 | + add: CHANGELOG.md |
| 78 | + message: 'chore: update CHANGELOG.md for new release' |
| 79 | + author_name: GitHub Actions |
| 80 | + author_email: action@github.com |
| 81 | + committer_name: GitHub Actions |
| 82 | + committer_email: actions@github.com |
| 83 | + push: true |
| 84 | + |
17 | 85 | manage_milestones: |
18 | 86 | name: Manage Milestones |
19 | 87 | runs-on: ubuntu-latest |
|
0 commit comments