File tree Expand file tree Collapse file tree 2 files changed +71
-0
lines changed
Expand file tree Collapse file tree 2 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Poll New Relic Agent Releases
2+
3+ on :
4+ schedule :
5+ - cron : " 0 * * * *"
6+
7+ jobs :
8+ nodejs :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v2
12+ - uses : actions/setup-python@v1
13+ with :
14+ python-version : " 3.7"
15+ - run : python -m pip install -U pip
16+ - run : pip install -U PyGitHub
17+ - run : python./poll_releases.py nodejs
18+ - uses : actions/create-release@latest
19+ with :
20+
21+ draft : true
22+ release_name : New Relic node Agent ${{ latest_version }}
23+ tag_name : ${{ tag_name }}
24+
25+ python :
26+ runs-on : ubuntu-latest
27+ steps :
28+ - uses : actions/checkout@v2
29+ - uses : actions/setup-python@v1
30+ with :
31+ python-version : " 3.7"
32+ - run : python -m pip install -U pip
33+ - run : pip install -U PyGitHub
34+ - run : python./poll_releases.py python
35+ - uses : actions/create-release@latest
36+ with :
37+ draft : true
38+ release_name : New Relic Python Agent ${{ latest_version }}
39+ tag_name : ${{ tag_name }}
Original file line number Diff line number Diff line change 1+ import requests
2+ import sys
3+
4+ from github import Github
5+
6+ runtime = sys .argv [- 1 ]
7+ if runtime not in ("nodejs" , "python" ):
8+ print ("::error file=poll_releases.py::Unsupported runtime value" )
9+ sys .exit (1 )
10+
11+ gh = Github ()
12+ repo = gh .get_repo ("newrelic/newrelic-lambda-layers" )
13+ releases = repo .get_releases ()
14+ tag_names = [release .tag_name for release in releases ]
15+
16+ if runtime == "nodejs" :
17+ package = requests .get ("https://libraries.io/api/npm/newrelic/" ).json ()
18+ elif runtime == "python" :
19+ package = requests .get ("https://libraries.io/api/pypi/newrelic/" ).json ()
20+
21+ latest_version = "v%s" % package ["latest_release_number" ]
22+ tag_name = "%s_%s" % (latest_version , runtime )
23+
24+ if tag_name in tag_names :
25+ print ("::error file=poll_releases.py::Tag already exists" )
26+ sys .exit (1 )
27+
28+ print ("::set-env name=latest_version::%s" % latest_version )
29+ print ("::set-env name=tag_name::%s" % tag_name )
30+
31+ print ("::set-output name=latest_version::%s" % latest_version )
32+ print ("::set-output name=tag_name::%s" % tag_name )
You can’t perform that action at this time.
0 commit comments