diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 109bd4c..db18e72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,5 +57,6 @@ jobs: - name: Create release uses: softprops/action-gh-release@v2 with: + name: "NocoDB Mobile (Unofficial prototype) v${{ github.ref }}" files: "build/app/outputs/flutter-apk/app-release.apk" prerelease: ${{ contains(github.ref, 'dev') }} diff --git a/Makefile b/Makefile index 59baf34..b3f1f32 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +release: + python3 scripts/release.py + run_integration_test rit: flutter run --dart-define-from-file=integration_test/.env -t integration_test/hello_test.dart diff --git a/scripts/release.py b/scripts/release.py new file mode 100644 index 0000000..6424f8a --- /dev/null +++ b/scripts/release.py @@ -0,0 +1,47 @@ +from datetime import datetime +import subprocess + +DRY_RUN = False + +def run(command: str) -> str: + return subprocess.run( + command, + shell=True, + capture_output=True, + text=True + ).stdout.strip() + +def version_up(latest_tag): + parts = latest_tag.split('.') + + latest_yymm = f"{parts[0]}.{parts[1]}" + current_yymm = datetime.now().strftime("%y.%m") + + if latest_yymm == current_yymm: + if len(parts) == 3: + new_minor = int(parts[2]) + 1 + else: + new_minor = 1 + return f"{current_yymm}.{new_minor}" + else: + return current_yymm + +# print(version_up("23.02")) # 24.06 +# print(version_up("23.02.5")) # 24.06 +# print(version_up("24.06")) # 24.06.1 +# print(version_up("24.06.1")) # 24.06.2 + +now = datetime.now() +YYMM = now.strftime("%y.%m") + +latest_tag = run("gh release list --json tagName --jq '.[0] | .tagName'") +print(f'latest tag: {latest_tag}') + +new_tag = version_up(latest_tag) +print(f'new tag: {new_tag}') + +push_command = f"git tag {new_tag} && git push origin main {new_tag}" +if not DRY_RUN: + run(push_command) +else: + print(push_command)