Release #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| permissions: write-all | |
| runs-on: ubuntu-latest | |
| env: | |
| BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
| CHANNEL_ID: ${{ secrets.CHANNEL_ID }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| cache-dependency-path: | | |
| **/*.gradle* | |
| **/gradle-wrapper.properties | |
| gradle/libs.versions.toml | |
| **/gradle.properties | |
| - name: Get version and SHA | |
| id: vars | |
| run: | | |
| VERSION=$(grep 'versionName' app/build.gradle.kts | sed -n 's/.*versionName = "\([^ ]*\).*/\1/p') | |
| SHA8=$(git rev-parse --short=8 HEAD) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$VERSION-$SHA8" >> $GITHUB_OUTPUT | |
| - name: Write key | |
| env: | |
| KEY_STORE: ${{ secrets.KEY_STORE }} | |
| run: | | |
| if [ ! -z "$KEY_STORE" ]; then | |
| echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties | |
| echo androidKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties | |
| echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties | |
| echo androidStoreFile='key.jks' >> gradle.properties | |
| echo "$KEY_STORE" | base64 --decode > key.jks | |
| fi | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build all variants | |
| run: ./gradlew assembleWhatsappRelease assembleBusinessRelease | |
| - name: Upload to GitHub release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| name: WaEnhancer ${{ steps.vars.outputs.version }} | |
| body_path: changelog.txt | |
| files: | | |
| app/build/outputs/apk/whatsapp/release/WaEnhancer*.apk | |
| app/build/outputs/apk/business/release/WaEnhancer-Business*.apk | |
| tag_name: ${{ steps.vars.outputs.tag }} | |
| - name: Read changelog | |
| id: changelog | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const changelog = fs.readFileSync('changelog.txt', 'utf8').trim(); | |
| core.setOutput('content', changelog); | |
| - name: Post to Telegram channel | |
| if: ${{ env.BOT_TOKEN != '' }} | |
| uses: Dev4Mod/telegram-github-action@master | |
| with: | |
| to: ${{ env.CHANNEL_ID }} | |
| token: ${{ env.BOT_TOKEN }} | |
| format: markdown | |
| disable_web_page_preview: true | |
| message: | | |
| ${{ steps.changelog.outputs.content }} | |
| Release: https://github.com/${{ github.repository }}/releases/tag/${{ steps.vars.outputs.tag }} |