Added the ability to publish on Telegram #29
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: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - ystinia | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set artifact name | |
| id: vars | |
| run: | | |
| if [ "${{ github.ref_name }}" = "master" ]; then | |
| echo "name=Decoder" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=Decoder-NG" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: gradle | |
| - name: Build | |
| env: | |
| KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASS: ${{ secrets.KEY_PASS }} | |
| run: | | |
| echo "${{ secrets.KEY }}" | base64 -d > key.jks | |
| ./gradlew bundleRelease | |
| mv app/build/outputs/bundle/release/app-release.aab ${{ steps.vars.outputs.name }}.aab | |
| ./gradlew assembleRelease | |
| mv app/build/outputs/apk/release/app-release.apk ${{ steps.vars.outputs.name }}.apk | |
| - name: Upload | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| files: | | |
| ${{ steps.vars.outputs.name }}.aab | |
| ${{ steps.vars.outputs.name }}.apk | |
| - name: Telegram | |
| run: | | |
| TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n" | |
| TG_ICON="\xE2\x9C\x85 GitHub Actions" | |
| TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON}) | |
| TG_TOKEN=${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}} | |
| TG_CHANNEL=${{secrets.TELEGRAM_CHANNEL_OPENIPC_DEV}} | |
| HTTP=$(curl -s -o /dev/null -w %{http_code} https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${{ steps.vars.outputs.name }}.apk) | |
| echo Telegram response: ${HTTP} |