Skip to content

Commit

Permalink
Update publish_alpha.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Shebyyy authored Nov 25, 2024
1 parent 229d324 commit e5a6e67
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/publish_alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fetch-depth: 0

- name: Download last SHA artifact
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@v6
with:
workflow: publish_alpha.yml
name: last-sha
Expand All @@ -43,14 +43,17 @@ jobs:
else
LAST_SHA=$(git rev-list --max-parents=0 HEAD)
fi
echo "Commits since $LAST_SHA:"
COMMIT_LOGS=$(git log "$LAST_SHA"..HEAD --pretty=format:"● %s ~%an [֍](https://github.com/MrBoomDeveloper/Awery/commit/%H)" --max-count=10)
COMMIT_LOGS=$(echo "$COMMIT_LOGS" | sed -E 's/#([0-9]+)/[#\1](https:\/\/github.com\/MrBoomDeveloper\/Awery\/pull\/\1)/g')
COMMIT_LOGS="${COMMIT_LOGS//'%'/'%25'}"
COMMIT_LOGS="${COMMIT_LOGS//$'\n'/'%0A'}"
COMMIT_LOGS="${COMMIT_LOGS//$'\r'/'%0D'}"
echo "COMMIT_LOG=${COMMIT_LOGS}" >> $GITHUB_ENV
echo "$COMMIT_LOGS" > commit_log.txt
BRANCH=${{ github.ref }}
BRANCH=${BRANCH#refs/heads/}
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
Expand All @@ -66,6 +69,7 @@ jobs:
VERSION="$VER+${SHA:0:7}"
echo "Version $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup JDK 17
if: ${{ env.SKIP_BUILD != 'true' }}
uses: actions/setup-java@v4
Expand All @@ -92,15 +96,20 @@ jobs:
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

- name: Rename APK File
run: |
mv app/build/outputs/apk/alpha/release/app-alpha-release-signed.apk app/build/outputs/apk/alpha/release/Awery_Alpha.apk
- name: Upload Alpha APK
uses: actions/upload-artifact@v4
with:
name: "Alpha APK"
retention-days: 90
path: "app/build/outputs/apk/alpha/release/app-alpha-release-signed.apk"
path: "app/build/outputs/apk/alpha/release/Awery_Alpha.apk"

- name: Upload APK to Discord and Telegram
if: false
shell: bash
run: |
fetch_user_details() {
Expand All @@ -116,11 +125,13 @@ jobs:
additional_info["Sheby"]="\n Discord: <@612532963938271232>\n AniList: [Sheby](<https://anilist.co/user/5724017/>)"
additional_info["itsmechinmoy"]="\n Discord: <@523539866311720963>\n AniList: [itsmechinmoy](<https://anilist.co/user/6110204/>)"
additional_info["MrBoomDev"]="\n Discord: <@1034891767822176357>"
declare -A contributor_colors
default_color="6121629"
contributor_colors["Sheby"]="#ff9b46"
contributor_colors["itsmechinmoy"]="#5d689d"
contributor_colors["MrBoomDev"]="#ff7e95"
hex_to_decimal() { printf '%d' "0x${1#"#"}"; }
declare -A recent_commit_counts
Expand Down Expand Up @@ -188,6 +199,7 @@ jobs:
developer_entry="◗ **${name}** ${extra_info}
- Github: [${login}](https://github.com/${login})
- Commits: ${branch_commit_count}"
if [ -n "$developers" ]; then
developers="${developers}
${developer_entry}"
Expand All @@ -213,6 +225,7 @@ jobs:
if [ ${#commit_messages} -gt $max_length ]; then
commit_messages="${commit_messages:0:$max_length}"
fi
discord_data=$(jq -nc \
--arg field_value "$commit_messages" \
--arg author_value "$developers" \
Expand All @@ -221,7 +234,7 @@ jobs:
--arg thumbnail_url "$thumbnail_url" \
--argjson embed_color "$embed_color" \
'{
"content": "<@&1225347048321191996>",
"content": "<@&1208839371575529572>",
"embeds": [
{
"title": "New Alpha-Build dropped 🔥",
Expand Down Expand Up @@ -259,12 +272,12 @@ jobs:
if [ "$SKIP_BUILD" != "true" ]; then
curl -F "payload_json=${contentbody}" \
-F "Awery_debug=@app/build/outputs/apk/alpha/release/app-alpha-release-signed.apk" \
-F "Awery_debug=@app/build/outputs/apk/alpha/release/Awery_Alpha.apk" \
${{ secrets.DISCORD_WEBHOOK_URL }}
else
echo "Skipping APK upload to Discord due to SKIP_BUILD being set to true"
fi
COMMIT_LOG=$(cat commit_log.txt)
COMMIT_LOG=$(cat commit_log.txt)
if [ ${#COMMIT_LOG} -gt 1024 ]; then
COMMIT_LOG="${COMMIT_LOG:0:900}"
fi
Expand All @@ -275,6 +288,7 @@ jobs:
echo "$message"
done)
telegram_commit_messages="<blockquote>${telegram_commit_messages}</blockquote>"
echo "$developers" > dev_info.txt
echo "$developers"
chmod +x workflowscripts/tel_parser.sed
Expand All @@ -283,8 +297,9 @@ jobs:
telegram_dev_info="<blockquote>${dev_info_tel}</blockquote>"
echo "$telegram_dev_info"
if [ "$SKIP_BUILD" != "true" ]; then
APK_PATH="app/build/outputs/apk/alpha/release/app-alpha-release-signed.apk"
APK_PATH="app/build/outputs/apk/alpha/release/Awery_Alpha.apk"
response=$(curl -sS -f -X POST \
"https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \
-F "chat_id=-1002066701332" \
Expand Down

0 comments on commit e5a6e67

Please sign in to comment.