-
Notifications
You must be signed in to change notification settings - Fork 5
50 lines (44 loc) · 1.49 KB
/
version.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
name: Version Check
on:
pull_request:
types:
- opened
- synchronize
jobs:
check:
name: check if version is bumped
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Verify version is bumped or not
id: version_check
env:
tags_url: ${{ toJson(github.event.pull_request.base.repo.tags_url) }}
run: |
import json
import os
from distutils.version import StrictVersion
from urllib import request
file_name = "plugin.json"
repo_name = os.environ["GITHUB_REPOSITORY"]
res = request.urlopen("https://api.github.com/repos/{}/tags".format(repo_name))
data = res.read().decode("utf-8")
tags = json.loads(data)
latest_release_version = StrictVersion(tags[0]["name"].replace('v', ''))
with open(file_name, 'r') as f:
data = json.load(f)
current_version = StrictVersion(data["version"])
print("::set-output name=is_version_bumped::{0}".format(current_version > latest_release_version))
shell: python
- uses: christianvuerings/add-labels@v1
if: steps.version_check.outputs.is_version_bumped == 'True'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
labels: |
ReleaseCandidate