Merge pull request #42 from EYOB123695/main #45
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: Build and distribute (staging) | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
- main | |
pull_request: | |
types: | |
- opened | |
- reopened | |
branches: | |
- dev | |
- master | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Notify contributors | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.STAGING_TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.STAGING_TELEGRAM_BOT_TOKEN }} | |
format: HTML | |
message: | | |
project: ScholArxiv | |
build_type: Staging | |
commit: <a href="https://github.com/${{ github.repository }}/commit/${{ github.sha }}">${{ env.SHORT_SHA }}</a> | |
diff: <a href="https://github.com/${{ github.repository }}/compare/${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}">${{ env.SHORT_BASE_SHA }}...${{ env.SHORT_HEAD_SHA }}</a> | |
pull_request: <a href="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}">#${{ github.event.pull_request.number }}</a> | |
repo: <a href="https://github.com/${{ github.repository }}">${{ github.repository }}</a> | |
assignedTo: ${{ secrets.ASSIGNED_TO }} | |
message: Built APK will be sent in a moment... | |
- name: Setup JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ secrets.FLUTTER_VERSION || env.FLUTTER_VERSION || '3.4.4' }} # goes for secrets, then environments defaults to 3.4.4 | |
- name: Build | |
run: chmod +x ./scripts/build-and-filter-errors.sh && ./scripts/build-and-filter-errors.sh | |
- name: Send error | |
if: always() | |
uses: appleboy/telegram-action@master | |
with: | |
message: Build Output file incoming... | |
to: ${{ secrets.STAGING_TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.STAGING_TELEGRAM_BOT_TOKEN }} | |
document: ${{ github.workspace }}/build_output.log | |
- name: Generate SHORT_SHA | |
run: | | |
echo "SHORT_SHA=`echo ${{ github.sha }} | cut -c1-8`" >> $GITHUB_ENV | |
echo "SHORT_BASE_SHA=`echo ${{ github.event.pull_request.base.sha }} | cut -c1-8`" >> $GITHUB_ENV | |
echo "SHORT_HEAD_SHA=`echo ${{ github.event.pull_request.head.sha }} | cut -c1-8`" >> $GITHUB_ENV | |
- name: Send build to Telegram group | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.STAGING_TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.STAGING_TELEGRAM_BOT_TOKEN }} | |
format: HTML | |
message: | | |
version: ${{ env.BUILD_VERSION }} | |
client_id: ScholArxiv | |
build_type: Staging | |
commit: <a href="https://github.com/${{ github.repository }}/commit/${{ github.sha }}">${{ env.SHORT_SHA }}</a> | |
diff: <a href="https://github.com/${{ github.repository }}/compare/${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}">${{ env.SHORT_BASE_SHA }}...${{ env.SHORT_HEAD_SHA }}</a> | |
pull_request: <a href="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}">#${{ github.event.pull_request.number }}</a> | |
repo: <a href="https://github.com/${{ github.repository }}">${{ github.repository }}</a> | |
document: ${{ github.workspace }}/build/app/outputs/flutter-apk/app-release.apk |