Automatically Convert CHANGELOG to Fastlane

This commit is contained in:
Sylvia van Os
2021-08-30 21:26:30 +02:00
parent a81cc27414
commit 6223ccd4bc
5 changed files with 131 additions and 79 deletions

27
.github/changelog_to_fastlane.py vendored Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/python3
import os
import re
changelogs = {}
with open('CHANGELOG.md') as changelog:
version_code = None
text = []
for line in changelog:
if line.startswith("## "):
if version_code != None:
changelogs[version_code] = text
text = []
match = re.match("## \S* - (\d*) \(\d{4}-\d{2}-\d{2}\)", line)
if not match:
raise ValueError(f"Invalid version line: {line}")
version_code = match.group(1)
else:
text.append(line)
for version, description in changelogs.items():
with open(os.path.join("fastlane", "metadata", "android", "en-US", "changelogs", f"{version}.txt"), "w") as fastlane_file:
fastlane_file.write("".join(description).strip())

View File

@@ -0,0 +1,24 @@
name: Convert CHANGELOG to Fastlane
on:
push:
branches: [ master ]
jobs:
convert_changelog_to_fastlane:
runs-on: ubuntu-latest
name: Convert CHANGELOG to Fastlane
steps:
- name: Checkout repo
id: checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Run converter script
run: python .scripts/changelog_to_fastlane.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "Update Fastlane changelogs"
commit-message: "Update Fastlane changelogs"

View File

@@ -1,3 +1,4 @@
name: Write contributors to file
on:
push:
branches: [ master ]