Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
IamRezaMousavi committed Jun 25, 2024
1 parent 9695de4 commit f579223
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 14 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: set up JDK
uses: actions/setup-java@v4
with:
Expand All @@ -19,9 +20,6 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Run android lint
run: ./gradlew lint

Expand All @@ -36,3 +34,4 @@ jobs:

- name: Build Debug
run: ./gradlew assembleDebug

39 changes: 39 additions & 0 deletions .github/workflows/gradle-wrapper-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Gradle wrapper update

on:
workflow_dispatch: # to run the workflow manually if needed
schedule:
- cron: '0 12 * * *'

jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
cache: gradle

- name: Upgrade gradle wrapper
run: |
./gradlew wrapper --gradle-version latest
./gradlew wrapper --gradle-version latest
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: 'Upgrade Gradle version'
body: ''
delete-branch: false
branch: 'upgrade-gradle-version'
commit-message: 'upgrade gradle version'

20 changes: 9 additions & 11 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Run android lint
run: ./gradlew lint

Expand Down Expand Up @@ -80,12 +77,13 @@ jobs:
ANDROID_NIGHTLY_KEYSTORE_ALIAS: ${{ secrets.ANDROID_NIGHTLY_KEYSTORE_ALIAS }}
run: ./gradlew assembleNightly

- name: Get apk file path
id: apkFile
run: echo "apkfile=$(find app/build/outputs/apk/nightly/*.apk)" >> $GITHUB_OUTPUT
- name: Send apk to telegram
run: |
mv $(find . -type f -iname *.apk) banafsh-nightly.apk
apk_path="banafsh-nightly.apk"
curl https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument \
-F chat_id=${{ secrets.TELEGRAM_CHAT_ID }} \
-F "caption=Size: $(ls -l --block-size=K "$apk_path" | awk '{ print $5 }')" \
-F parse_mode=HTML \
-F document=@"$apk_path"
- name: Upload Nightly Build to Artifacts
uses: actions/upload-artifact@v4
with:
name: banafsh-nightly.apk
path: ${{ steps.apkFile.outputs.apkfile }}
39 changes: 39 additions & 0 deletions .github/workflows/telegram-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Notify

permissions:
contents: read

on:
push:
branches:
- master

jobs:
notify:
name: Notify via Telegram
runs-on: ubuntu-latest
steps:
- name: Notify
env:
COMMITS: ${{ toJson(github.event.commits) }}
TEMPLATE: '.[] | "<a href=\"\(.url)\">\(.id[:8])</a> • <a href=\"https://github.com/\(.author.username | @html)\">\(.author.username | @html)</a>
\(.message | gsub("(?<a>[<>&\"])"; .a|@html))
"'
run: |
(
printf '🎧 <a href="https://github.com/IamRezaMousavi/Banafsh">Banafsh</a>\n\n'
printenv COMMITS | jq -r "$TEMPLATE"
printf '🆔: @iamrezamousaviapp'
) | \
jq -R --slurp '{
text: .,
disable_web_page_preview: true,
chat_id: "${{ secrets.TELEGRAM_CHAT_ID }}",
parse_mode: "HTML"
}' | \
curl -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage \
-H 'Content-Type: application/json' \
--data-binary @-

0 comments on commit f579223

Please sign in to comment.