forked from kerimovscreations/SRP-Nimbus-Swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from PB-Digital/develop
RELEASE: v3.8.2
- Loading branch information
Showing
9 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "**/*.md" | ||
- ".gitignore" | ||
branches: | ||
- master | ||
pull_request: | ||
paths-ignore: | ||
- "**/*.md" | ||
- ".gitignore" | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Build | ||
uses: actions/checkout@v3 | ||
|
||
- run: xcodebuild -scheme SRP -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Create tag and release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- "**/*.md" | ||
- ".gitignore" | ||
jobs: | ||
create-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Get version number and release notes | ||
id: version_and_notes | ||
run: | | ||
current_version=$(python CI/echo_current_version.py) | ||
release_notes=$(python CI/echo_release_notes.py) | ||
echo "::set-output name=tag::$current_version" | ||
echo "::set-output name=notes::$release_notes" | ||
- name: Create tag and release | ||
uses: avakar/tag-and-release@v1 | ||
id: tag_and_release | ||
with: | ||
tag_name: ${{ steps.version_and_notes.outputs.tag }} | ||
body: ${{ steps.version_and_notes.outputs.notes }} | ||
release_name: "v${{ steps.version_and_notes.outputs.tag }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create branch from tag | ||
uses: peterjgrainger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: "release/v${{ steps.version_and_notes.outputs.tag }}" | ||
|
||
- run: | | ||
echo "Tag already present: ${{ env.TAG_EXISTS }}" | ||
- run: | | ||
echo "Tag already present: ${{ steps.tag_create.outputs.tag_exists }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Version Check | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "**/*.md" | ||
- ".gitignore" | ||
branches: | ||
- master | ||
|
||
jobs: | ||
version-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Get Latest Version | ||
id: latest_release_version | ||
uses: pozetroninc/[email protected] | ||
with: | ||
owner: PB-Digital | ||
repo: srp-ios | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Compare Versions | ||
run: | | ||
release_version=${{ steps.latest_release_version.outputs.release }} | ||
python CI/check_version.py $release_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from models import Config | ||
from config_parser import get_raw_config | ||
from typing import Any | ||
from sys import argv | ||
import json | ||
|
||
def parse_version(version_string: str) -> list[int]: | ||
return [ int(i) for i in version_string.split('.') ] | ||
|
||
def get_current_version(config: Config) -> list[int]: | ||
return parse_version(config.version) | ||
|
||
def compare_versions(release: list[int], current: list[int]) -> bool: | ||
if len(release) != len(current): | ||
print('\n\033[1;31m' + '❌ Version formats does not match!\n') | ||
exit(1) | ||
|
||
for r, c in zip(release, current): | ||
if c > r: | ||
return True | ||
elif c < r: | ||
return False | ||
|
||
return False | ||
|
||
def main(): | ||
release_version_string: str = argv.pop() | ||
|
||
release_version: list[int] = parse_version(release_version_string) | ||
current_version: list[int] = get_current_version(get_raw_config()) | ||
|
||
is_valid: bool = compare_versions(release_version, current_version) | ||
|
||
if is_valid: | ||
print('\n\033[1;32m' + '✅ Valid\n') | ||
else: | ||
print('\n\033[1;31m' + '❌ Not valid\n') | ||
exit(2) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import json | ||
from typing import Any | ||
from models import Config | ||
|
||
def get_raw_config() -> Config: | ||
with open('Config.json', 'r') as file: | ||
config = json.load(file) | ||
return Config( | ||
version = config['version'], | ||
release_notes = config['release_notes'] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from config_parser import get_raw_config | ||
|
||
if __name__ == '__main__': | ||
print(get_raw_config().version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from config_parser import get_raw_config | ||
|
||
if __name__ == '__main__': | ||
print(get_raw_config().release_notes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from dataclasses import dataclass | ||
|
||
@dataclass | ||
class Config: | ||
version: str | ||
release_notes: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": "3.8.2", | ||
"release_notes": "CI/CD integrated" | ||
} |