-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (46 loc) · 1.54 KB
/
bump-version.yaml
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
name: "Bump version"
on:
pull_request:
branches:
- v2
types:
- closed
jobs:
bump-version:
name: Bump version depending on labels
runs-on: ubuntu-latest
if: |
github.event.pull_request.merged == true && (
contains(github.event.pull_request.labels.*.name, 'patch') ||
contains(github.event.pull_request.labels.*.name, 'minor') )
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Bump version
run: |
IFS=',' read -r -a label_array <<< "${{ join(github.event.pull_request.labels.*.name, ',') }}"
if [[ "${label_array[*]}" =~ "minor" ]]; then
yarn version --minor --no-git-tag-version
elif [[ "${label_array[*]}" =~ "patch" ]]; then
yarn version --patch --no-git-tag-version
else
echo "No version bump needed"
fi
- name: Install dependencies
run: yarn
- name: Generate builds
run: yarn build
- name: Get the new version
id: get_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
- name: Commit and push changes
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add package.json dist/
git commit -m "Bump version to ${{ steps.get_version.outputs.version }}"
git push origin HEAD:v2