From 69a672c26e1801d9fe26b172496df309dc9dde69 Mon Sep 17 00:00:00 2001 From: Max Theilig Date: Mon, 6 Nov 2023 10:47:16 +0100 Subject: [PATCH] Fix/publishing and prs (#316) * publishing script and pr with version upgrade --- .github/PULL_REQUEST_TEMPLATE.md | 33 +++--------- .../PR_Template_Contributor.md | 32 +++++++++++ .../PR_Template_VersionUpgrade.md | 54 +++++++++++++++++++ .gitignore | 1 + scripts/config.yaml | 26 +++++++++ scripts/release_publish.py | 18 +++---- scripts/update_version.sh | 13 ----- 7 files changed, 129 insertions(+), 48 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md create mode 100644 scripts/config.yaml delete mode 100644 scripts/update_version.sh diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 81ad2c5b..7753d413 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,30 +1,11 @@ - +Please go the the `Preview` tab and select the appropriate sub-template: -## Description - +[**Contributor PR**](?expand=1&template=PR_Template_Contributor.md) -## Motivation and Context - - - +[Version Upgrade **(for Admins)**](?expand=1&template=PR_Template_VersionUpgrade.md) -## How has this been tested? - - - - -## Snippets or Screenshots (if necessary): - -## Types of changes - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - -## Checklist: - - -- [ ] My code follows the code style of this IG / specification. -- [ ] My change requires a change to the documentation or narrative (intend) of the IG. -- [ ] I have already updated the documentation / narrative (intend) accordingly. \ No newline at end of file + + +## Pull Request Short Cut + \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md b/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md new file mode 100644 index 00000000..4d417179 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PR_Template_Contributor.md @@ -0,0 +1,32 @@ + +# Contributor Pull Request + + +## Description + + +## Motivation and Context + + + + +## How has this been tested? + + + + + +## Snippets or Screenshots (if necessary): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + +## Checklist: + + +- [ ] My code follows the code style of this IG / specification. +- [ ] My change requires a change to the documentation or narrative (intend) of the IG. +- [ ] I have already updated the documentation / narrative (intend) accordingly. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md new file mode 100644 index 00000000..27bd1785 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PR_Template_VersionUpgrade.md @@ -0,0 +1,54 @@ +# Version Upgrade Template + + +Version: + +Date: + +## Description + +This is a Pullreuqest that requires an increase in the Version number. Therefore, multiple outside-github, related Task have to be performed and checked. + +All jobs with an `x` in the boxes were performed to the best of knowledge. + +## Pre-Merge Activities + +- [ ] This PR refers to a versioned Branch with a name and a version number in the form of N.n.n, e.g. "TC_3.2.1". +- [ ] This PR has a clean meaningful committ history. Minor committs or committs without descirption have been squashed, at the latest now. +- [ ] The _./github/workflows/main.yml_ refers to the correct Firetly Terminal and SUSHI Version. + > **_Firely Terminal Pipeline_** 0.4.0. + + > **_SUSHI Versions_** 3.5.0. +- [ ] By running the _Release_Publish.py_ script, release version and date was updated accordingly. The script ran without errors. +- [ ] Eventually, increase the dependency of to newer Basis Modul (package and sushi-config) +- [ ] New Release Notes were created, aglined to the committ history and cleaned. In Github, go to + - [ ] _-> Releases_ then _-> Draft a new release_ with the _Modul Name and Version_, then + - [ ] _-> Target the main-Branch_ and _->enter a new Tag according to the Version_, then click. + - [ ] Click _-> Generate Release notes_ , _->Adjust them if necessary_ and _-> Copy/Paste the Details in the RealeaseNotes.md_ of the very Branch you want to merge. + - [ ] Finally _-> Save as Draft_ + +## Merge and Publishing + + +- [ ] With the updated Version, Dates, and Release Notes (as described above) with the last committ into the Branch you want to merge. +- [ ] In GitHub _-> Actions_ the _->CI (FHIR Validation)_ workflow terminates successfully. +- [ ] Add the Approve / the PR gets posivitly reviewed by a collegue. +- [ ] Merge (without squash) the PR, delete the Branch. + + +## Post-Merge Activities + + +- [ ] Go to the corresponding SIMPLIFIER Project and _-> Github -> Reimport_ the project. +- [ ] Go to the corresponding SIMPLIFIER Project and _-> Packages -> Expand the Dropdown for Create -> Create new package_ for the project. + - [ ] With the corresponding version number, and + - [ ] The Release notes (from above) and a compare-link to the previous Release. +- [ ] Publish the previosuly drafteted Release, including version number, on GitHub. +- [ ] Provide / Archive the IG in the corresponding _gh-pages_ branch of the GitHub project. + - [ ] Checkout the Branch (no need to merge it later). + - [ ] Export from Simplifier via _-> Guides -> Expand the Modul ... -> Export_ + - [ ] Unpack the zip, remove the packages folder (because its kinda big), and move everything else to a (version coressponding) new folder in the branch folder structure. + - [ ] committ the branch. + + +## Finished diff --git a/.gitignore b/.gitignore index 34df97f7..6515dd43 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /fhirpkg.lock.json +.vscode/* diff --git a/scripts/config.yaml b/scripts/config.yaml new file mode 100644 index 00000000..ab23a178 --- /dev/null +++ b/scripts/config.yaml @@ -0,0 +1,26 @@ +package.json: + - type: version + regex: '("version":\s*")([\d\.]+.*)(")' +sushi-config.yaml: + - type: version + regex: '(version:\s*)(\d+\.\d+\.\d+.*)()' +ruleset.fsh: + - type: version + regex: + - '(\*\s*version\s*=\s*")([\d\.]+.*)(")' + - '(\*\s*\^version\s*=\s*")([\d\.]+.*)(")' + - '(\*\s*implementationGuide\s*=\s*".*\|)([\d\.]+.*)(")' + - type: date + regex: + - '(\*\s*date\s*=\s*")(\d+\-\d+\-\d+)(")' + - '(\*\s*\^date\s*=\s*")(\d+\-\d+\-\d+)(")' + format: '%Y-%m-%d' +Einfuehrung.md: + - type: version + regex: '(Version: \s*)(\d+\.\d+\.\d+.*)()' + - type: date + regex: '(Datum:\s*)(\d+\.\d+\.\d+.*)()' + format: '%d.%m.%Y' +ImplementierungsleitfadenIsiK_basismodul.json: + - type: version + regex: '("version":\s*")(\d+\.\d+\.\d+.*)(",)' \ No newline at end of file diff --git a/scripts/release_publish.py b/scripts/release_publish.py index 5eead5d5..86adfa52 100644 --- a/scripts/release_publish.py +++ b/scripts/release_publish.py @@ -7,7 +7,7 @@ import yaml -class FileToUpdate: +class FileTypeCombinationToUpdate: def __init__(self, filename, content_type, regex_list, format=None) -> None: self.filename = filename self.content_type = content_type @@ -33,7 +33,7 @@ def create_files_to_update_list(config): for filename, replacements in config.items(): for replacement in replacements: files_to_update.append( - FileToUpdate( + FileTypeCombinationToUpdate( filename, replacement["type"], replacement["regex"] if isinstance(replacement["regex"], list) else [replacement["regex"]], @@ -68,14 +68,14 @@ def replace_content_in_files(files: list, new_release_version: str, new_date: da print("Error: No files found!") return - for file in files: - if file.content_type == "version": - replace_version_in_file(file, new_release_version) - elif file.content_type == "date": - replace_date_in_file(file, new_date) + for FileTypeCombination in files: + if FileTypeCombination.content_type == "version": + replace_version_in_file(FileTypeCombination, new_release_version) + elif FileTypeCombination.content_type == "date": + replace_date_in_file(FileTypeCombination, new_date) -def replace_version_in_file(file: FileToUpdate, new_release_version: str): +def replace_version_in_file(file: FileTypeCombinationToUpdate, new_release_version: str): with open(file.location, 'r') as input_file: input_text = input_file.read() @@ -88,7 +88,7 @@ def replace_version_in_file(file: FileToUpdate, new_release_version: str): output_file.write(input_text) -def replace_date_in_file(file: FileToUpdate, new_date: datetime): +def replace_date_in_file(file: FileTypeCombinationToUpdate, new_date: datetime): with open(file.location, 'r') as input_file: input_text = input_file.read() diff --git a/scripts/update_version.sh b/scripts/update_version.sh deleted file mode 100644 index 2cbe628d..00000000 --- a/scripts/update_version.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -clear -# This script will download the latest validation script from the template source save it -# to the scripts_folder and execute it to validate your fhir ressources. -script_name=release_publish.py -script_path=. - -#parentdir="$(dirname "$script_path")" -#mkdir -p "$parentdir" - -curl https://raw.githubusercontent.com/gematik/spec-TemplateForSimplifierProjects/feature/release_publish/scripts/$script_name -o $script_path -chmod a+x $script_path -python3 $script_name \ No newline at end of file