Repository navigation
ci: a release of its own for every 2.xx version (#157) #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2d9d139
c70d041
ee30456
ba0b088
9956b17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,14 +119,74 @@ jobs: | |
| tag_name: latest | ||
| files: ${{ steps.vars.outputs.name }}.apk | ||
|
|
||
| # v2: every version gets a release of its own (#157), at the commit that was built, with | ||
| # the APK and the merged PRs since the previous v2.* release. A push without a version | ||
| # bump (docs, CI) only updates "latest" above. Not marked Latest: the README links | ||
| # releases/tag/latest | ||
| - name: Versioned release | ||
| if: github.ref_name == 'v2' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| VER=$(sed -n 's/.*versionName "\(.*\)".*/\1/p' android/app/build.gradle) | ||
| TAG="v${VER}" | ||
| if [ -z "$VER" ]; then echo "No versionName found"; exit 1; fi | ||
| APK="decoder-v2-${VER}.apk" | ||
| cp decoder-v2.apk "$APK" | ||
| # An existing release is complete only with its APK (Qodo on #158) | ||
| has_apk() { | ||
| gh release view "$TAG" --json assets -q '.assets[].name' 2>/dev/null | grep -qx "$APK" | ||
| } | ||
| # Only the build of the tagged commit may add the missing APK (Qodo on #158) | ||
| repair_apk() { | ||
| TAGGED=$(gh api "repos/${{ github.repository }}/commits/$TAG" -q .sha) | ||
| if [ "$TAGGED" = "$(git rev-parse HEAD)" ]; then | ||
| gh release upload "$TAG" "$APK" --clobber | ||
| else | ||
| echo "::warning::$TAG has no $APK and points to ${TAGGED:0:7}, not this build" | ||
| fi | ||
|
Comment on lines
+146
to
+147
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Incomplete releases can appear successful repair_apk returns success after only printing a warning when the release tag points to a different commit. If an existing release lacks its APK and the current build is not of its tagged commit, the step exits successfully without uploading the missing asset. Agent Prompt
|
||
| } | ||
| if gh release view "$TAG" >/dev/null 2>&1; then | ||
| if has_apk; then | ||
| echo "Release $TAG exists: only latest was updated" | ||
| else | ||
| repair_apk | ||
| fi | ||
| exit 0 | ||
|
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
|
||
| fi | ||
| # The previous version by number, not by date: a manual build of an older commit may | ||
| # publish after a newer one (Qodo on #158) | ||
| # A failed lookup fails the step rather than publishing first-release notes | ||
| TAGS=$(gh api --paginate "repos/${{ github.repository }}/releases?per_page=100" \ | ||
| -q '.[].tag_name') | ||
| PREV=$(printf '%s\n' "$TAGS" | grep '^v2\.' | sed 's/^v//' | { cat; echo "$VER"; } \ | ||
| | sort -V -u | grep -B1 -x "$VER" | grep -v -x "$VER" || true) | ||
| if [ -n "$PREV" ]; then | ||
| NOTES=(--generate-notes --notes-start-tag "v$PREV") | ||
| else | ||
| NOTES=(--notes "First release of the 2.xx line (v2 branch). Earlier changes: https://github.com/${{ github.repository }}/commits/v2") | ||
| fi | ||
| if ! gh release create "$TAG" "$APK" --target "$(git rev-parse HEAD)" \ | ||
| --title "OpenIPC Decoder ${VER}" --latest=false "${NOTES[@]}"; then | ||
|
Comment on lines
+169
to
+170
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5. Pre-existing tags can get the wrong apk gh release create supplies the built commit through --target but does not check whether the version tag already exists. If that tag exists without a release and points to another commit, release creation uses the existing tag while attaching the current build's APK; the tag-commit check applies only to missing-asset repair. Agent Prompt
|
||
| # Another build of the same version created it meanwhile, or the upload failed: | ||
| # the release must exist and carry the APK, else the step fails | ||
| gh release view "$TAG" >/dev/null | ||
| has_apk || repair_apk | ||
| fi | ||
|
|
||
| - name: Telegram | ||
| if: github.ref_name == 'basic' || github.ref_name == 'v2' | ||
| run: | | ||
| # basic keeps its Gradle files at the top level; read only the one that exists | ||
| # (a missing file would fail the step under pipefail, Qodo on #158) | ||
| GRADLE=android/app/build.gradle | ||
| [ -f "$GRADLE" ] || GRADLE=app/build.gradle | ||
| VER=$(sed -n 's/.*versionName "\(.*\)".*/\1/p' "$GRADLE" | head -1) | ||
| GIT_HASH=$(git rev-parse --short HEAD) | ||
| GIT_BRANCH="${{ github.ref_name }}" | ||
| TAG_NAME="${{ github.ref_type == 'tag' && github.ref_name || '' }}" | ||
| TIME=$(date -u '+%Y-%m-%d %H:%M:%S UTC') | ||
| TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n" | ||
| TG_MSG="Version: ${VER}\nCommit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n" | ||
| TG_ICON="\xE2\x9C\x85 GitHub Actions" | ||
| TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON}) | ||
| TG_TOKEN=${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. A failed latest upload skips versioning
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools