Skip to content

Commit d503305

Browse files
authored
Merge pull request #105 from v2er-app/feature/auto-version-tagging
fix: use GitHub username in release changelog instead of git author name
2 parents dea77e5 + 1bc1f16 commit d503305

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,33 @@ jobs:
352352
353353
# Get commits since last tag
354354
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
355+
356+
# Function to get GitHub username from commit
357+
get_github_username() {
358+
local commit_sha="$1"
359+
# Try to get the GitHub username from the commit using gh api
360+
local username=$(gh api "repos/${{ github.repository }}/commits/${commit_sha}" --jq '.author.login // empty' 2>/dev/null || echo "")
361+
if [ -n "$username" ]; then
362+
echo "@$username"
363+
else
364+
# Fallback to git author name if API fails
365+
echo "@$(git show -s --format='%an' $commit_sha)"
366+
fi
367+
}
368+
369+
# Generate changelog with GitHub usernames
355370
if [ -n "$LAST_TAG" ]; then
356-
git log --pretty=format:"* %s by @%an" "$LAST_TAG"..HEAD >> CHANGELOG.md
371+
while IFS= read -r commit_sha; do
372+
commit_msg=$(git show -s --format='%s' $commit_sha)
373+
author=$(get_github_username $commit_sha)
374+
echo "* $commit_msg by $author" >> CHANGELOG.md
375+
done < <(git rev-list "$LAST_TAG"..HEAD)
357376
else
358-
git log --pretty=format:"* %s by @%an" -10 >> CHANGELOG.md
377+
while IFS= read -r commit_sha; do
378+
commit_msg=$(git show -s --format='%s' $commit_sha)
379+
author=$(get_github_username $commit_sha)
380+
echo "* $commit_msg by $author" >> CHANGELOG.md
381+
done < <(git rev-list HEAD -10)
359382
fi
360383
361384
echo "" >> CHANGELOG.md
@@ -758,43 +781,13 @@ jobs:
758781
echo "found=false" >> $GITHUB_OUTPUT
759782
fi
760783
761-
- name: Create Google Play link info
762-
if: steps.download-apk.outputs.found == 'true'
763-
id: play-link
764-
run: |
765-
VERSION_NAME="${{ needs.prepare.outputs.version }}"
766-
VERSION_CODE="${{ needs.prepare.outputs.version_code }}"
767-
768-
# Create info file about Google Play signing
769-
cat > "v2er-${VERSION_NAME}_google_play_signed_info.txt" << EOF
770-
Google Play Signed APK Information
771-
==================================
772-
Version: ${VERSION_NAME}
773-
Version Code: ${VERSION_CODE}
774-
Package: me.ghui.v2er
775-
776-
The APK attached (v2er-${VERSION_NAME}_google_play_signed.apk) is a universal APK
777-
generated from the AAB (Android App Bundle) that was uploaded to Google Play.
778-
779-
When downloaded from Google Play Store, the APK will be signed with Google Play's
780-
app signing certificate instead of the upload certificate.
781-
782-
Internal Testing Link:
783-
https://play.google.com/apps/test/me.ghui.v2er/${VERSION_CODE}
784-
785-
Note: Access to internal testing track required.
786-
EOF
787-
788-
echo "info_path=v2er-${VERSION_NAME}_google_play_signed_info.txt" >> $GITHUB_OUTPUT
789-
790784
- name: Upload signed APK to GitHub Release
791785
if: steps.download-apk.outputs.found == 'true'
792786
uses: softprops/action-gh-release@v2
793787
with:
794788
tag_name: ${{ needs.prepare.outputs.version }}
795789
files: |
796790
${{ steps.download-apk.outputs.apk_path }}
797-
${{ steps.play-link.outputs.info_path }}
798791
fail_on_unmatched_files: false
799792

800793
- name: Summary

0 commit comments

Comments
 (0)