chore: updated workflow #74
This file contains 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 Workflow | |
on: | |
push: | |
branches: | |
- 'release/**' | |
- 'test/**' | |
jobs: | |
telegram_bot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
- run: flutter pub upgrade | |
- run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Build APK | |
run: flutter build apk | |
- name: Check Successful Builds | |
id: build-status | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: | | |
flutter clean | |
FLAVOR=$( echo ${{ github.ref_name }} | cut -d '/' -f 1) | |
VERSION=$( echo ${{ github.ref_name }} | cut -d '/' -f 2) | |
SUCCESSFUL_BUILDS=$(gh api --header 'Accept: application/vnd.github+json' --method GET https://api.github.com/repos/rel1nce/coriz/actions/workflows/$FLAVOR.yml/runs?status=success | jq '.total_count') | |
echo "SUCCESSFUL_BUILDS=${SUCCESSFUL_BUILDS}" >> $GITHUB_OUTPUT | |
echo "FLAVOR=${FLAVOR}" >> $GITHUB_OUTPUT | |
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Send APK to Telegram | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TGCHANNELID }} | |
token: ${{ secrets.TGBOTID }} | |
message: | | |
New APK is available! Version: ${{ steps.build-status.outputs.FLAVOR }} {{ steps.build-status.outputs.VERSION }}+build_${{ steps.build-status.outputs.SUCCESSFUL_BUILDS }} | |
document: ./build/app/outputs/apk/release/app-release.apk |