mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-28 23:41:03 +00:00
reset: test original
This commit is contained in:
65
.github/workflows/beta.yml
vendored
65
.github/workflows/beta.yml
vendored
@@ -1,7 +1,6 @@
|
||||
name: Build APK and Notify Discord
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
@@ -13,7 +12,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI: true
|
||||
SKIP_BUILD: false
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
@@ -23,12 +21,12 @@ jobs:
|
||||
|
||||
|
||||
- name: Download last SHA artifact
|
||||
if: ${{ env.SKIP_BUILD != 'true' }}
|
||||
uses: dawidd6/action-download-artifact@v3
|
||||
with:
|
||||
workflow: beta.yml
|
||||
name: last-sha
|
||||
path: .
|
||||
|
||||
continue-on-error: true
|
||||
|
||||
- name: Get Commits Since Last Run
|
||||
@@ -42,14 +40,6 @@ jobs:
|
||||
echo "Commits since $LAST_SHA:"
|
||||
# Accumulate commit logs in a shell variable
|
||||
COMMIT_LOGS=$(git log $LAST_SHA..HEAD --pretty=format:"● %s ~%an")
|
||||
# Debugging: Print the raw commit logs
|
||||
echo "Raw commit logs:"
|
||||
echo "$COMMIT_LOGS"
|
||||
# Replace commit messages with pull request links
|
||||
COMMIT_LOGS=$(echo "$COMMIT_LOGS" | sed -E 's/#([0-9]+)/[#\1](https:\/\/github.com\/rebelonion\/Dantotsu\/pull\/\1)/g')
|
||||
# Debugging: Print the processed commit logs
|
||||
echo "Processed commit logs:"
|
||||
echo "$COMMIT_LOGS"
|
||||
# URL-encode the newline characters for GitHub Actions
|
||||
COMMIT_LOGS="${COMMIT_LOGS//'%'/'%25'}"
|
||||
COMMIT_LOGS="${COMMIT_LOGS//$'\n'/'%0A'}"
|
||||
@@ -81,20 +71,17 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
cache: gradle
|
||||
|
||||
|
||||
- name: List files in the directory
|
||||
run: ls -l
|
||||
|
||||
|
||||
- name: Make gradlew executable
|
||||
if: ${{ env.SKIP_BUILD != 'true' }}
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
if: ${{ env.SKIP_BUILD != 'true' }}
|
||||
run: ./gradlew assembleGoogleAlpha
|
||||
|
||||
- name: Upload a Build Artifact
|
||||
if: ${{ env.SKIP_BUILD != 'true' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Dantotsu
|
||||
@@ -107,47 +94,19 @@ jobs:
|
||||
run: |
|
||||
#Discord
|
||||
commit_messages=$(echo "$COMMIT_LOG" | sed 's/%0A/\n/g; s/^/\n/')
|
||||
max_length=1000
|
||||
# Truncate commit messages if they are too long
|
||||
max_length=1900 # Adjust this value as needed
|
||||
if [ ${#commit_messages} -gt $max_length ]; then
|
||||
commit_messages="${commit_messages:0:$max_length}... (truncated)"
|
||||
fi
|
||||
discord_data=$(jq -nc \
|
||||
--arg field_value "$commit_messages" \
|
||||
--arg footer_text "Version $VERSION" \
|
||||
--arg timestamp "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
|
||||
--arg thumbnail_url "https://avatars.githubusercontent.com/u/41344259?v=4" \
|
||||
'{
|
||||
"content": "@here",
|
||||
"embeds": [
|
||||
{
|
||||
"title": "New Alpha-Build dropped",
|
||||
"color": 15532323,
|
||||
"fields": [
|
||||
{
|
||||
"name": "Commits:",
|
||||
"value": $field_value,
|
||||
"inline": true
|
||||
}
|
||||
],
|
||||
"footer": {
|
||||
"text": $footer_text
|
||||
},
|
||||
"timestamp": $timestamp,
|
||||
"thumbnail": {
|
||||
"url": $thumbnail_url
|
||||
}
|
||||
}
|
||||
],
|
||||
"attachments": []
|
||||
}')
|
||||
echo "$discord_data"
|
||||
curl -H "Content-Type: application/json" \
|
||||
-d "$discord_data" \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
echo "$response_headers"
|
||||
contentbody=$( jq -nc --arg msg "Alpha-Build: <@&1225347048321191996> **$VERSION**:" --arg commits "$commit_messages" '{"content": ($msg + "\n" + $commits)}' )
|
||||
curl -F "payload_json=${contentbody}" -F "dantotsu_debug=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" ${{ secrets.DISCORD_WEBHOOK }}
|
||||
|
||||
curl -F "dantotsu_debug=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \
|
||||
${{ secrets.DISCORD_WEBHOOK }}
|
||||
#Telegram
|
||||
curl -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID }}" \
|
||||
-F "document=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \
|
||||
-F "caption=Alpha-Build: ${VERSION}: ${commit_messages}" \
|
||||
https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument
|
||||
|
||||
env:
|
||||
COMMIT_LOG: ${{ env.COMMIT_LOG }}
|
||||
|
||||
Reference in New Issue
Block a user