-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (82 loc) · 2.93 KB
/
changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Changelog generator
on:
push:
tags:
- '*'
jobs:
changelog_generator:
name: Changelog Generator
runs-on: ubuntu-20.04
env:
branch: master
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '16.13.0'
- name: Set local user
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git config --local pull.rebase false
- name: Get tag branch
run: |
branch_check=$(git branch -r --contains $(git rev-parse $GITHUB_REF~0) | sed 's/remotes\/origin\///' | sed 's/origin\///' | sed 's/develop//' | sed 's/* //' | sed -r '/^\s*$/d' | head -1)
echo $branch_check
if [[ $branch_check =~ ^(release|master)$ ]]; then
echo "Not correct branch. Allowed branches release and master."
exit 1
fi
echo "branch=$branch_check" >> $GITHUB_ENV
- uses: actions/checkout@v4
name: Checkout tag branch
with:
fetch-depth: 0
ref: ${{ env.branch }}
- name: Get tag
run: |
echo "Describe: $(git describe)"
echo "Rev parse: $(git rev-parse $GITHUB_REF~0)"
tag_check=$(git describe --exact-match `git rev-parse $GITHUB_REF~0`)
echo "TAG=$tag_check" >> $GITHUB_ENV
- name: Install dependencies
run: |
rm -rf node_modules
npm install
- name: Bump version
run: |
npm run bump-version
- name: Commit updated package.json
run: |
git add .
git commit -m "${{ env.TAG }}" --no-verify
- name: Generate changelog
run: |
npm run generate-changelog
- name: Commit changelog
run: |
git add CHANGELOG.md
git commit -m "docs(changelog): regenerate CHANGELOG.md [skip ci]"
- name: Remove tag
run: |
git tag -d ${{ env.TAG }}
- name: Updating tags
run: |
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
git tag -a ${{ env.TAG }} -m "${{ env.TAG }}"
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --tag -f
- name: Pushing latest changes to master
run: |
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" ${{ env.branch }}:master
- name: Checkout master
run: |
git checkout master
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
- name: Generate GitHub release notes
run: |
npm run github-release
continue-on-error: true