mirror of
https://github.com/vyos/vyos-documentation.git
synced 2025-10-26 08:41:46 +01:00
Merge pull request #450 from rebortg/master
Releasenotes: add weekly releasenote create script
This commit is contained in:
commit
292bce0919
22
.github/workflows/submodules.yml
vendored
22
.github/workflows/submodules.yml
vendored
@ -5,7 +5,7 @@ on:
|
||||
# 06:00 UTC on Monday
|
||||
- cron: '0 6 * * 1'
|
||||
jobs:
|
||||
updateVyOS-1x_master:
|
||||
update_master:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -19,21 +19,26 @@ jobs:
|
||||
git checkout current
|
||||
git pull
|
||||
git submodule status
|
||||
- name: update releasenotes
|
||||
run: |
|
||||
pip3 install phabricator
|
||||
python3 docs/_ext/releasenotes.py -t ${{ secrets.PHABRICATOR_API }} -b current equuleus
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
commit-message: "vyos-1x: update current branch"
|
||||
commit-message: "Github: update current branch"
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
title: "vyos-1x: update current branch"
|
||||
title: "Github: update current branch"
|
||||
body: |
|
||||
Autoupdate vyos-1x submodule
|
||||
update releasenotes
|
||||
branch: update-dependencies-master
|
||||
delete-branch: true
|
||||
|
||||
|
||||
updateVyOS-1x_equuleus:
|
||||
update_equuleus:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -48,15 +53,20 @@ jobs:
|
||||
git checkout equuleus
|
||||
git pull
|
||||
git submodule status
|
||||
- name: update releasenotes
|
||||
run: |
|
||||
pip3 install phabricator
|
||||
python3 docs/_ext/releasenotes.py -t ${{ secrets.PHABRICATOR_API }} -b equuleus
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
commit-message: "vyos-1x: update equuleus branch"
|
||||
commit-message: "Github: update equuleus branch"
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
title: "vyos-1x: update equuleus branch"
|
||||
title: "Github: update equuleus branch"
|
||||
body: |
|
||||
Autoupdate vyos-1x submodule
|
||||
update releasenotes
|
||||
branch: update-dependencies-equuleus
|
||||
delete-branch: true
|
||||
|
||||
102
docs/_ext/releasenotes.py
Normal file
102
docs/_ext/releasenotes.py
Normal file
@ -0,0 +1,102 @@
|
||||
from datetime import datetime
|
||||
from phabricator import Phabricator
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-t", "--token", type=str, help="API token", required=True)
|
||||
parser.add_argument("-b", "--branch", nargs="+", help="List of github branches", required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
phab = Phabricator(host='https://phabricator.vyos.net/api/', token=args.token)
|
||||
|
||||
'''
|
||||
# code to find new PHIDs
|
||||
# show project ids
|
||||
projects = phab.project.query(limit=200)
|
||||
for project in projects.response['data']:
|
||||
print(projects.response['data'][project]['phid'], projects.response['data'][project]['name'])
|
||||
'''
|
||||
|
||||
projects = {
|
||||
'equuleus': {
|
||||
'phid': 'PHID-PROJ-zu26ui4vbmvykpjtepij',
|
||||
'name': 'VyOS 1.3 Equuleus',
|
||||
'filename': 'docs/changelog/1.3.rst',
|
||||
'tasks': [],
|
||||
'releasenotes': []
|
||||
},
|
||||
'current': {
|
||||
'phid': 'PHID-PROJ-m4utvy456e2shcprpq3b',
|
||||
'name': 'VyOS 1.4 Sagitta',
|
||||
'filename': 'docs/changelog/1.4.rst',
|
||||
'tasks': [],
|
||||
'releasenotes': []
|
||||
}
|
||||
}
|
||||
|
||||
for b in args.branch:
|
||||
if b not in projects.keys():
|
||||
raise Exception('given branch not defined')
|
||||
|
||||
# get project tasks
|
||||
|
||||
for project in projects:
|
||||
if project not in args.branch:
|
||||
continue
|
||||
|
||||
_after = None
|
||||
|
||||
# get tasks from API
|
||||
while True:
|
||||
#print(f'get {_after}')
|
||||
_tasks = phab.maniphest.search(
|
||||
constraints={
|
||||
'projects': [projects[project]['phid']],
|
||||
#'statuses': ['closed'],
|
||||
},
|
||||
after=_after)
|
||||
|
||||
projects[project]['tasks'].extend(_tasks.response['data'])
|
||||
_after = _tasks.response['cursor']['after']
|
||||
if _after is None:
|
||||
break
|
||||
|
||||
# prepare tasks for release notes
|
||||
for task in projects[project]['tasks']:
|
||||
if task['fields']['status']['value'] in ['resolved']:
|
||||
#_info = phab.maniphest.info(task_id=task['id'])
|
||||
#_info = _info.response
|
||||
releasenote = {}
|
||||
releasenote['type'] = task['fields']['subtype']
|
||||
date = datetime.fromtimestamp(task['fields']['dateClosed'])
|
||||
releasenote['closedate'] = date.strftime('%Y%m%d')
|
||||
releasenote['name'] = task['fields']['name']
|
||||
releasenote['id'] = task['id']
|
||||
#print(f"{project}: {task['fields']['status']} {task['id']}")
|
||||
projects[project]['releasenotes'].append(releasenote)
|
||||
|
||||
projects[project]['releasenotes'] = sorted(
|
||||
projects[project]['releasenotes'], key = lambda x: x['closedate'],
|
||||
reverse=True
|
||||
)
|
||||
|
||||
rst_text = "#" * len(projects[project]['name'])
|
||||
rst_text += f"\n{projects[project]['name']}\n"
|
||||
rst_text += "#" * len(projects[project]['name'])
|
||||
rst_text += "\n"
|
||||
|
||||
date = None
|
||||
for rn in projects[project]['releasenotes']:
|
||||
if date != rn['closedate']:
|
||||
rst_text += "\n\n"
|
||||
rst_text += f"{rn['closedate']}\n"
|
||||
underline = '=' * len(rn['closedate'])
|
||||
rst_text += f"{underline}\n\n"
|
||||
date = rn['closedate']
|
||||
rst_text += f"* :vytask:`T{rn['id']}` ({rn['type']}): {rn['name']}\n"
|
||||
|
||||
f = open(projects[project]['filename'], "w")
|
||||
f.write(rst_text)
|
||||
f.close()
|
||||
@ -1 +1 @@
|
||||
Subproject commit 0dd41096f14771ffa476f52793308bffac51b59a
|
||||
Subproject commit 86209c679c6b7ca9d5bac1f67ffd391b9b16c008
|
||||
3
docs/changelog/1.3.rst
Normal file
3
docs/changelog/1.3.rst
Normal file
@ -0,0 +1,3 @@
|
||||
#################
|
||||
VyOS 1.3 Equuleus
|
||||
#################
|
||||
3
docs/changelog/1.4.rst
Normal file
3
docs/changelog/1.4.rst
Normal file
@ -0,0 +1,3 @@
|
||||
################
|
||||
VyOS 1.4 Sagitta
|
||||
################
|
||||
@ -10,6 +10,8 @@ Changelog
|
||||
:maxdepth: 1
|
||||
:includehidden:
|
||||
|
||||
1.4
|
||||
1.3
|
||||
1.2.6
|
||||
1.2.5
|
||||
1.2.4
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user