Skip to content

Commit

Permalink
feat: Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
doananhtuan22111996 committed Aug 31, 2024
1 parent 075d0bc commit 100c303
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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: Download Artifact - Keystore
uses: timheuer/base64-to-file@v1.2
with:
filename: 'root-keystore-dev.jks'
fileDir: './app/android/'
encodedString: ${{ secrets.ROOT_KEYSTORE_DEV }}

- name: Download Artifact - env
uses: timheuer/base64-to-file@v1.2
with:
filename: '.env.zip'
fileDir: './configs/'
encodedString: ${{ secrets.ENV }}

- name: Unzip env
run: |
cd configs && jar xf .env.zip
- name: Setup project
run: |
echo "Accept permision..."
make denied
echo "Install bootstrap..."
make pre-bootstrap
echo "Pub get..."
make gh-pub-get
- name: Build Release bundle
run: make gh-build-android flavor=dev

- name: Sending release build to Telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: 🚀 New Release Published on DEV! >>> ${{github.head_ref}}.
24 changes: 24 additions & 0 deletions .github/workflows/notifier.yml
Original file line number Diff line number Diff line change
@@ -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}}
55 changes: 55 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Prod 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: Download Artifact - Keystore
uses: timheuer/base64-to-file@v1.2
with:
filename: 'root-keystore-prod.jks'
fileDir: './app/android/'
encodedString: ${{ secrets.ROOT_KEYSTORE_PROD }}

- name: Download Artifact - env
uses: timheuer/base64-to-file@v1.2
with:
filename: '.env.zip'
fileDir: './configs/'
encodedString: ${{ secrets.ENV }}

- name: Unzip env
run: |
cd configs && jar xf .env.zip
- name: Setup project
run: |
echo "Accept permision..."
make denied
echo "Install bootstrap..."
make pre-bootstrap
echo "Pub get..."
make gh-pub-get
- name: Build Release bundle
run: make gh-build-android flavor=prod

- name: Sending release build to Telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: 🚀 New Release Published on PROD! >>> ${{github.head_ref}}.
58 changes: 58 additions & 0 deletions .github/workflows/widget_book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: WidgetBook 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: Download Artifact - Keystore
uses: timheuer/base64-to-file@v1.2
with:
filename: 'root-keystore-dev.jks'
fileDir: './app/android/'
encodedString: ${{ secrets.ROOT_KEYSTORE_DEV }}

- name: Download Artifact - env
uses: timheuer/base64-to-file@v1.2
with:
filename: '.env.zip'
fileDir: './configs/'
encodedString: ${{ secrets.ENV }}

- name: Unzip env
run: |
cd configs && jar xf .env.zip
- name: Setup project
run: |
echo "Accept permision..."
make denied
echo "Install bootstrap..."
make pre-bootstrap
echo "Pub get..."
make gh-pub-get
- name: Build WidgetBook Dev
run: make gh-widget-book flavor=dev

- name: Build WidgetBook Prod
run: make gh-widget-book flavor=prod

- name: Sending release build to Telegram
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: 🚀 New Release Published on WidgetBook! >>> ${{github.head_ref}}.
4 changes: 4 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,7 @@ gh-deploy-android-apk:
gh-deploy-android-aab:
fvm flutter pub global run melos gen-env $(flavor)
dart run scripts/deploy_app.dart $(flavor) aab $(buildName) $(buildNumber)

gh-widget-book:
fvm flutter pub global run melos gen-env $(flavor)
dart run scripts/run_widget_book.dart $(flavor)

0 comments on commit 100c303

Please sign in to comment.