From 464f42b4f9cfb3b282007ead5dc6a537b2026ad5 Mon Sep 17 00:00:00 2001 From: Jason Doan Date: Sun, 25 Aug 2024 23:54:03 +0700 Subject: [PATCH] feat: Add github actions --- .github/workflows/dev.yml | 74 ++++++++++++++++++++++++++++++++++ .github/workflows/notifier.yml | 24 +++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/notifier.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..48edf2d --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,74 @@ +name: Dev CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # Note: This workflow uses the latest stable version of the Dart SDK. + # You can specify other versions if desired, see documentation here: + # https://github.com/dart-lang/setup-dart/blob/main/README.md + # - uses: dart-lang/setup-dart@v1 + - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 + + - name: Setup permission + run: cd scripts && chmod +x pre-bootstrap.sh + + - name: Install bootstrap + run: | + cd scripts && ls + sh pre-bootstrap.sh +# fvm install 3.22.3 +# fvm use 3.22.3 --force +# fvm flutter --version + +# - name: Pub get +# run: | +# @melos clean --sdk-path=.fvm/flutter_sdk +# @melos bootstrap --sdk-path=.fvm/flutter_sdk +# @melos gen-app-icon +# @melos gen-app-splash +# @melos build-domain +# @melos build-data +# @melos build-resources +# @melos gen-strings + +# - name: Setup env +# env: +# ENV_DEV_PROPERTIES: ${{ secrets.ENV_DEV_PROPERTIES }} +# ROOT_KEYSTORE_DEV: ${{ secrets.ROOT_KEYSTORE_DEV }} +# ENV_PROD_PROPERTIES: ${{ secrets.ENV_PROD_PROPERTIES }} +# ROOT_KEYSTORE_PROD: ${{ secrets.ROOT_KEYSTORE_PROD }} +# run: | +# echo -n ${ENV_DEV_PROPERTIES} | base64 -d > env.dev.properties +# echo -n ${ROOT_KEYSTORE_DEV} | base64 -d > root-keystore-dev.jks +# echo -n ${ENV_PROD_PROPERTIES} | base64 -d > env.prod.properties +# echo -n ${ROOT_KEYSTORE_PROD} | base64 -d > root-keystore-prod.jks +# +# - name: Get release file aab path +# id: releaseAab +# run: echo "aabfile=$(find app/build/outputs/bundle/dev/release/*.aab)" >> $GITHUB_OUTPUT +# +# - name: Get release file apk path +# id: releaseApk +# run: echo "apkfile=$(find app/build/outputs/apk/dev/release/*.apk)" >> $GITHUB_OUTPUT +# +# - name: Zip Files +# uses: papeloto/action-zip@v1 +# with: +# files: ${{ steps.releaseAab.outputs.aabfile }} ${{ steps.releaseApk.outputs.apkfile }} +# dest: app-dev-release.zip + + - name: Sending release build to Telegram + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} +# document: app-dev-release.zip + message: 🚀 New Release Published on DEV! >>> ${{github.head_ref}}. \ No newline at end of file diff --git a/.github/workflows/notifier.yml b/.github/workflows/notifier.yml new file mode 100644 index 0000000..9c4f467 --- /dev/null +++ b/.github/workflows/notifier.yml @@ -0,0 +1,24 @@ +name: Notifier + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + name: Sent telegram message + runs-on: ubuntu-latest + steps: + - name: send telegram message on push + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + ${{ github.actor }} created commit: + Branch: ${{github.head_ref}} + Commit message: ${{ github.event.commits[0].message }} + Repository: ${{ github.repository }} + See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} \ No newline at end of file