-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (44 loc) · 1.37 KB
/
versioning.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
name: Bump version
on:
push:
branches:
- main
paths:
- "**/*.js"
- "**/*.json"
- "**/*.svg"
pull_request:
branches:
- main
paths:
- "**/*.js"
- "**/*.json"
- "**/*.svg"
jobs:
bump_version:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip versioning]')"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Bump version in plugin.json
id: bump_version
run: |
current_version=$(cat plugin.json | jq -r '.version')
IFS='.' read -r major minor patch <<< "$current_version"
new_version="$major.$minor.$((patch + 1))"
echo "New version: $new_version"
jq --arg new_version "$new_version" '.version = $new_version' plugin.json > plugin.json.tmp
mv plugin.json.tmp plugin.json
echo "version=$new_version" >> $GITHUB_ENV
- name: Commit and push updated plugin.json
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "actions@github.com"
git add plugin.json
git commit -m "Bump version to ${{ env.version }}"
git push origin main
- name: Create tag
run: |
git tag -a "v.${{ env.version }}" -m "v.${{ env.version }}"
git push origin --tags