chore: updated workflow #5
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: Check Successful Builds | |
id: build-status | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: | | |
FLAVOR=$( echo ${{ github.ref_name }} | cut -d '/' -f 1) | |
VERSION=$( echo ${{ github.ref_name }} | cut -d '/' -f 2) | |
SUCCESSFUL_RELEASE_BUILDS=$( gh api --header 'Accept: application/vnd.github+json' --method GET https://api.github.com/repos/rel1nce/coriz/actions/workflows/release.yml/runs?branch=release/$VERSION&status=success | jq -r '.total_count' ) | |
SUCCESSFUL_TEST_BUILDS=$( gh api --header 'Accept: application/vnd.github+json' --method GET https://api.github.com/repos/rel1nce/coriz/actions/workflows/release.yml/runs?branch=test/$VERSION&status=success | jq -r '.total_count' ) | |
SUCCESSFUL_BUILDS=$(( $SUCCESSFUL_RELEASE_BUILDS + $SUCCESSFUL_TEST_BUILDS )) | |
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! Final version: ${{ steps.build-status.outputs.FLAVOR }} {{ steps.build-status.outputs.VERSION }}--build_number=${{ steps.build-status.outputs.SUCCESSFUL_BUILDS }} |