mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 13:48:52 +01:00
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:
@@ -174,6 +174,15 @@ jobs:
|
|||||||
find . -name '*.apk' -type f -exec sha256sum {} \; > checksums.txt
|
find . -name '*.apk' -type f -exec sha256sum {} \; > checksums.txt
|
||||||
echo "checksums_path=checksums.txt" >> "$GITHUB_OUTPUT"
|
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:
|
generate_release_notes:
|
||||||
needs: build
|
needs: build
|
||||||
uses: ./.github/workflows/generate-release-notes.yml
|
uses: ./.github/workflows/generate-release-notes.yml
|
||||||
@@ -201,9 +210,16 @@ jobs:
|
|||||||
{
|
{
|
||||||
echo "clean_notes<<EOF"
|
echo "clean_notes<<EOF"
|
||||||
cat sanitized_notes.txt
|
cat sanitized_notes.txt
|
||||||
|
echo ""
|
||||||
echo "EOF"
|
echo "EOF"
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Download build artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-artifacts
|
||||||
|
path: downloaded/
|
||||||
|
|
||||||
- name: Publish GitHub release
|
- name: Publish GitHub release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
@@ -213,9 +229,8 @@ jobs:
|
|||||||
prerelease: ${{ inputs.prerelease }}
|
prerelease: ${{ inputs.prerelease }}
|
||||||
body: ${{ steps.clean_notes.outputs.clean_notes }}
|
body: ${{ steps.clean_notes.outputs.clean_notes }}
|
||||||
files: |
|
files: |
|
||||||
${{ needs.build.outputs.apk_release_path }}
|
downloaded/**/*.apk
|
||||||
${{ needs.build.outputs.apk_fdroid_path }}
|
downloaded/*.txt
|
||||||
${{ needs.build.outputs.checksums_path }}
|
|
||||||
fail_on_unmatched_files: true
|
fail_on_unmatched_files: true
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -94,13 +94,19 @@ jobs:
|
|||||||
output_file.write(f"new_version_code={new_code}\n")
|
output_file.write(f"new_version_code={new_code}\n")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
|
- name: Upload modified build.gradle
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: version-bump-artifact
|
||||||
|
path: presentation/build.gradle
|
||||||
|
|
||||||
generate_release_notes:
|
generate_release_notes:
|
||||||
needs: bump-version
|
needs: bump-version
|
||||||
uses: ./.github/workflows/generate-release-notes.yml
|
uses: ./.github/workflows/generate-release-notes.yml
|
||||||
with:
|
with:
|
||||||
version_name: ${{ needs.bump-version.outputs.new_version_name }}
|
version_name: ${{ needs.bump-version.outputs.new_version_name }}
|
||||||
|
|
||||||
open_release_pr:
|
generate_app_changelog:
|
||||||
needs: [bump-version, generate_release_notes]
|
needs: [bump-version, generate_release_notes]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -111,6 +117,102 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: true
|
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
|
- name: Open release PR
|
||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user