Merge pull request #694 from Inhishonor/update-release-workflow

Rework the release workflow to be more reliable and to provide an in app changelog
This commit is contained in:
octoshrimpy
2026-01-25 12:49:29 -05:00
committed by GitHub
2 changed files with 121 additions and 4 deletions
+18 -3
View File
@@ -174,6 +174,15 @@ jobs:
find . -name '*.apk' -type f -exec sha256sum {} \; > checksums.txt
echo "checksums_path=checksums.txt" >> "$GITHUB_OUTPUT"
- name: Upload all build outputs
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
${{ steps.release_artifact.outputs.apk_release_path }}
${{ steps.fdroid_artifact.outputs.apk_fdroid_path }}
${{ steps.checksums.outputs.checksums_path }}
generate_release_notes:
needs: build
uses: ./.github/workflows/generate-release-notes.yml
@@ -201,9 +210,16 @@ jobs:
{
echo "clean_notes<<EOF"
cat sanitized_notes.txt
echo ""
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: downloaded/
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
@@ -213,9 +229,8 @@ jobs:
prerelease: ${{ inputs.prerelease }}
body: ${{ steps.clean_notes.outputs.clean_notes }}
files: |
${{ needs.build.outputs.apk_release_path }}
${{ needs.build.outputs.apk_fdroid_path }}
${{ needs.build.outputs.checksums_path }}
downloaded/**/*.apk
downloaded/*.txt
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+103 -1
View File
@@ -94,13 +94,19 @@ jobs:
output_file.write(f"new_version_code={new_code}\n")
PY
- name: Upload modified build.gradle
uses: actions/upload-artifact@v4
with:
name: version-bump-artifact
path: presentation/build.gradle
generate_release_notes:
needs: bump-version
uses: ./.github/workflows/generate-release-notes.yml
with:
version_name: ${{ needs.bump-version.outputs.new_version_name }}
open_release_pr:
generate_app_changelog:
needs: [bump-version, generate_release_notes]
runs-on: ubuntu-latest
@@ -111,6 +117,102 @@ jobs:
fetch-depth: 0
persist-credentials: true
- name: Prepare release notes
id: prepare_notes
env:
NOTES: ${{ needs.generate_release_notes.outputs.release_notes }}
run: |
set -euo pipefail
python3 <<'PY'
import os, re, pathlib
notes = os.environ.get("NOTES", "")
clean = re.sub(
r'(?im)^\s*by\s+\S+\s+in\s+.*$',
'',
re.sub(r'(?im)^\s*["\']?\*\*Full\s+Changelog\*\*\s*:\s*.*$', '', notes)
).rstrip()
pathlib.Path("sanitized_notes.txt").write_text(clean)
PY
{
echo "clean_notes<<EOF"
cat sanitized_notes.txt
echo ""
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Add to changelog.json
env:
VERSION_NAME: ${{ needs.bump-version.outputs.new_version_name }}
VERSION_CODE: ${{ needs.bump-version.outputs.new_version_code }}
CLEAN_NOTES: ${{ steps.prepare_notes.outputs.clean_notes }}
run: |
set -euo pipefail
python3 <<'PY'
import json
import os
from pathlib import Path
changelog_path = Path("data/src/main/assets/changelog.json")
version_name = os.environ["VERSION_NAME"]
version_code = int(os.environ["VERSION_CODE"])
notes_raw = os.environ.get("CLEAN_NOTES", "")
notes = [
line.strip()
for line in notes_raw.splitlines()
if line.strip()
]
if changelog_path.exists():
changelog = json.loads(changelog_path.read_text())
else:
changelog = []
new_entry = {
"versionCode": version_code,
"versionName": version_name,
"fixed": notes
}
changelog.insert(0, new_entry)
changelog_path.write_text(
json.dumps(changelog, indent=2, ensure_ascii=False) + "\n"
)
PY
- name: Upload changelog.json
uses: actions/upload-artifact@v4
with:
name: changelog-json-artifact
path: data/src/main/assets/changelog.json
open_release_pr:
needs: [bump-version, generate_release_notes, generate_app_changelog]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
- name: Download modified build.gradle
uses: actions/download-artifact@v4
with:
name: version-bump-artifact
path: presentation/
- name: Download modified changelog
uses: actions/download-artifact@v4
with:
name: changelog-json-artifact
path: data/src/main/assets/
- name: Open release PR
uses: peter-evans/create-pull-request@v7
with: