Release: use fork update source and upstream-based changelog delta
Point in-app release checks/changelog links to the Forgejo fork and generate release notes against upstream komikku-app baseline commits for clearer fork-specific change visibility. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
de5e0a32d3
commit
384aee7372
3 changed files with 55 additions and 11 deletions
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
origin_url="${GITHUB_SERVER_URL#https://}"
|
||||
origin_url="${origin_url#http://}"
|
||||
git remote add origin "https://copilot:${FORGEJO_TOKEN}@${origin_url}/${GITHUB_REPOSITORY}.git"
|
||||
git -c http.sslVerify=false fetch --tags --prune --depth=1 origin "${GITHUB_SHA}"
|
||||
git -c http.sslVerify=false fetch --tags --prune origin "${GITHUB_SHA}"
|
||||
git checkout --force FETCH_HEAD
|
||||
|
||||
- name: Set up JDK
|
||||
|
|
@ -80,12 +80,32 @@ jobs:
|
|||
version_tag="${GITHUB_REF_NAME:-${GITHUB_REF#refs/tags/}}"
|
||||
version_display="$(printf '%s' "$version_tag" | sed -E 's/^v//' )"
|
||||
previous_tag="$(git tag --list 'v*' --sort=-version:refname | grep -Fxv "$version_tag" | head -n 1 || true)"
|
||||
upstream_repo="komikku-app/komikku"
|
||||
upstream_ref=""
|
||||
upstream_base=""
|
||||
for ref in master main; do
|
||||
candidate="$(git ls-remote "https://github.com/${upstream_repo}.git" "refs/heads/${ref}" | awk '{print $1}' || true)"
|
||||
if [ -n "$candidate" ]; then
|
||||
upstream_ref="$ref"
|
||||
upstream_base="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "VERSION_TAG=$version_tag" >> "$GITHUB_OUTPUT"
|
||||
echo "VERSION_DISPLAY=$version_display" >> "$GITHUB_OUTPUT"
|
||||
echo "PREV_TAG_NAME=$previous_tag" >> "$GITHUB_OUTPUT"
|
||||
echo "UPSTREAM_REPO=$upstream_repo" >> "$GITHUB_OUTPUT"
|
||||
echo "UPSTREAM_REF=$upstream_ref" >> "$GITHUB_OUTPUT"
|
||||
echo "UPSTREAM_BASE=$upstream_base" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [ -n "$previous_tag" ]; then
|
||||
if [ -n "$upstream_base" ]; then
|
||||
git fetch --no-tags --depth=1 "https://github.com/${upstream_repo}.git" "$upstream_base" || true
|
||||
fi
|
||||
|
||||
if [ -n "$upstream_base" ] && git cat-file -e "${upstream_base}^{commit}" 2>/dev/null; then
|
||||
commit_logs="$(git log --pretty=format:'- %s (@%an)' "${upstream_base}..HEAD")"
|
||||
elif [ -n "$previous_tag" ]; then
|
||||
commit_logs="$(git log --pretty=format:'- %s (@%an)' "${previous_tag}..HEAD")"
|
||||
else
|
||||
commit_logs='- Initial release'
|
||||
|
|
@ -262,6 +282,9 @@ jobs:
|
|||
VERSION_TAG: ${{ steps.prepare.outputs.VERSION_TAG }}
|
||||
VERSION_DISPLAY: ${{ steps.prepare.outputs.VERSION_DISPLAY }}
|
||||
PREV_TAG_NAME: ${{ steps.prepare.outputs.PREV_TAG_NAME }}
|
||||
UPSTREAM_REPO: ${{ steps.prepare.outputs.UPSTREAM_REPO }}
|
||||
UPSTREAM_REF: ${{ steps.prepare.outputs.UPSTREAM_REF }}
|
||||
UPSTREAM_BASE: ${{ steps.prepare.outputs.UPSTREAM_BASE }}
|
||||
COMMIT_LOGS: ${{ steps.prepare.outputs.COMMIT_LOGS }}
|
||||
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
|
||||
REPOSITORY_NAME: ${{ github.repository }}
|
||||
|
|
@ -357,6 +380,10 @@ jobs:
|
|||
if [ -n "${PREV_TAG_NAME:-}" ]; then
|
||||
full_changelog="**Full Changelog**: [${REPOSITORY_NAME}@${PREV_TAG_NAME}...${VERSION_TAG}](${REPO_URL}/compare/${PREV_TAG_NAME}...${VERSION_TAG})"
|
||||
fi
|
||||
fork_delta_label=""
|
||||
if [ -n "${UPSTREAM_BASE:-}" ] && [ -n "${UPSTREAM_REF:-}" ]; then
|
||||
fork_delta_label="Fork delta vs ${UPSTREAM_REPO}@${UPSTREAM_REF} (${UPSTREAM_BASE})"
|
||||
fi
|
||||
|
||||
release_body="$(printf '%s\n' \
|
||||
"## Komikku ${VERSION_DISPLAY}" \
|
||||
|
|
@ -375,7 +402,18 @@ jobs:
|
|||
"- Assets use stable names for Obtainium compatibility." \
|
||||
"- Versioned files follow: \`Komikku-v<version>-<abi>.apk\`." \
|
||||
"" \
|
||||
<<<<<<< HEAD
|
||||
"${full_changelog}")"
|
||||
=======
|
||||
"${fork_delta_label}" \
|
||||
"" \
|
||||
"${full_changelog}" \
|
||||
"" \
|
||||
"<!-->" \
|
||||
"> [!TIP]" \
|
||||
">" \
|
||||
"> ### If you are unsure which version to download then go with \`Komikku-universal.apk\`")"
|
||||
>>>>>>> c31f3fb7b8 (Release: use fork update source and upstream-based changelog delta)
|
||||
|
||||
"${JQ_BIN}" -n \
|
||||
--arg tag "${VERSION_TAG}" \
|
||||
|
|
|
|||
|
|
@ -93,13 +93,17 @@ class AppUpdateChecker(
|
|||
// KMK <--
|
||||
}
|
||||
|
||||
private const val RELEASES_WEB_BASE_URL = "https://192.168.1.155:3030"
|
||||
private const val FORK_RELEASE_REPO = "copilot/komikku"
|
||||
private const val FORK_PREVIEW_RELEASE_REPO = "copilot/komikku-preview"
|
||||
|
||||
val GITHUB_REPO: String by lazy { getGithubRepo() }
|
||||
|
||||
fun getGithubRepo(peekIntoPreview: Boolean = false): String =
|
||||
if (isPreviewBuildType || peekIntoPreview) {
|
||||
"komikku-app/komikku-preview"
|
||||
FORK_PREVIEW_RELEASE_REPO
|
||||
} else {
|
||||
"komikku-app/komikku"
|
||||
FORK_RELEASE_REPO
|
||||
}
|
||||
|
||||
val RELEASE_TAG: String by lazy { getReleaseTag() }
|
||||
|
|
@ -111,4 +115,4 @@ fun getReleaseTag(peekIntoPreview: Boolean = false): String =
|
|||
"v${BuildConfig.VERSION_NAME}"
|
||||
}
|
||||
|
||||
val RELEASE_URL = "https://github.com/$GITHUB_REPO/releases/tag/$RELEASE_TAG"
|
||||
val RELEASE_URL = "$RELEASES_WEB_BASE_URL/$GITHUB_REPO/releases/tag/$RELEASE_TAG"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ReleaseServiceImpl(
|
|||
override suspend fun latest(arguments: GetApplicationRelease.Arguments): Release? {
|
||||
val release = with(json) {
|
||||
networkService.client
|
||||
.newCall(GET("https://api.github.com/repos/${arguments.repository}/releases/latest"))
|
||||
.newCall(GET("$RELEASES_API_BASE_URL/repos/${arguments.repository}/releases/latest"))
|
||||
.awaitSuccess()
|
||||
.parseAs<GithubRelease>()
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ class ReleaseServiceImpl(
|
|||
return Release(
|
||||
version = release.version,
|
||||
info = release.info.substringBeforeLast("<!-->").replace(gitHubUsernameMentionRegex) { mention ->
|
||||
"[${mention.value}](https://github.com/${mention.value.substring(1)})"
|
||||
"[${mention.value}]($RELEASES_WEB_BASE_URL/${mention.value.substring(1)})"
|
||||
},
|
||||
releaseLink = release.releaseLink,
|
||||
downloadLink = downloadLink,
|
||||
|
|
@ -39,7 +39,7 @@ class ReleaseServiceImpl(
|
|||
override suspend fun releaseNotes(arguments: GetApplicationRelease.Arguments): List<Release> {
|
||||
return with(json) {
|
||||
networkService.client
|
||||
.newCall(GET("https://api.github.com/repos/${arguments.repository}/releases"))
|
||||
.newCall(GET("$RELEASES_API_BASE_URL/repos/${arguments.repository}/releases"))
|
||||
.awaitSuccess()
|
||||
.parseAs<List<GithubRelease>>()
|
||||
.mapNotNull { release ->
|
||||
|
|
@ -48,7 +48,7 @@ class ReleaseServiceImpl(
|
|||
Release(
|
||||
version = release.version,
|
||||
info = release.info.replace(gitHubUsernameMentionRegex) { mention ->
|
||||
"[${mention.value}](https://github.com/${mention.value.substring(1)})"
|
||||
"[${mention.value}]($RELEASES_WEB_BASE_URL/${mention.value.substring(1)})"
|
||||
}
|
||||
.substringBeforeLast("<!-->")
|
||||
// KMK -->
|
||||
|
|
@ -58,7 +58,7 @@ class ReleaseServiceImpl(
|
|||
val repo = matchResult.groups["repo"]!!.value
|
||||
val from = matchResult.groups["from"]!!.value
|
||||
val to = matchResult.groups["to"]!!.value
|
||||
"[$owner/$repo@$from...$to](https://github.com/$owner/$repo/compare/$from...$to)"
|
||||
"[$owner/$repo@$from...$to]($RELEASES_WEB_BASE_URL/$owner/$repo/compare/$from...$to)"
|
||||
},
|
||||
// KMK <--
|
||||
releaseLink = release.releaseLink,
|
||||
|
|
@ -86,6 +86,8 @@ class ReleaseServiceImpl(
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val RELEASES_WEB_BASE_URL = "https://192.168.1.155:3030"
|
||||
private const val RELEASES_API_BASE_URL = "$RELEASES_WEB_BASE_URL/api/v1"
|
||||
private const val FOSS = "foss"
|
||||
private val BUILD_TYPES = listOf(FOSS, "arm64-v8a", "armeabi-v7a", "x86_64", "x86")
|
||||
|
||||
|
|
@ -112,7 +114,7 @@ class ReleaseServiceImpl(
|
|||
* Convert from: https://github.com/komikku-app/komikku/compare/23d862d17...48fb4a2e6
|
||||
* to: [komikku-app/komikku@23d862d17...48fb4a2e6](https://github.com/komikku-app/komikku/compare/23d862d17...48fb4a2e6)
|
||||
*/
|
||||
private val gitHubCommitsCompareRegex = """(\[[^]]+]\()?https://github\.com/(?<owner>[^/]+)/(?<repo>[^/]+)/compare/(?<from>[0-9a-f.rv]+)\.\.\.(?<to>[0-9a-f.rv]+)\)?"""
|
||||
private val gitHubCommitsCompareRegex = """(\[[^]]+]\()?https?://[^/]+/(?<owner>[^/]+)/(?<repo>[^/]+)/compare/(?<from>[0-9a-f.rv]+)\.\.\.(?<to>[0-9a-f.rv]+)\)?"""
|
||||
.toRegex(RegexOption.IGNORE_CASE)
|
||||
// KMK <--
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue