From 3e1ed9f09e614843c47720e37a22bbf352824077 Mon Sep 17 00:00:00 2001 From: hendisantika Date: Wed, 17 Jan 2024 15:39:48 +0700 Subject: [PATCH] =?UTF-8?q?Setup=20CI=20CD=204=20=F0=9F=AB=B8=F0=9F=8C=80?= =?UTF-8?q?=E2=9C=8F=EF=B8=8F=F0=9F=93=97=20:octocat:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/app_center.yml | 42 ++++++++++++++++++++++++++++ .github/workflows/deploy_android.yml | 33 ++++++++++++++++++++++ .github/workflows/deploy_ios.yml | 16 +++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/workflows/app_center.yml create mode 100644 .github/workflows/deploy_android.yml create mode 100644 .github/workflows/deploy_ios.yml diff --git a/.github/workflows/app_center.yml b/.github/workflows/app_center.yml new file mode 100644 index 0000000..d8d8495 --- /dev/null +++ b/.github/workflows/app_center.yml @@ -0,0 +1,42 @@ +name: Deploy Flutter App on AppCenter +on: + push: + branches: + - main + - 'releases/**' +jobs: + setup-flutter: + name: Setup Flutter + runs-on: self-hosted + steps: + - run: echo "🎉 Triggered by a ${{ github.event_name }} on ${{ github.ref }}" + - name: Check out repository code + uses: actions/checkout@v3 + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.2 + - uses: subosito/flutter-action@v2 + with: + channel: master + architecture: x64 + - run: flutter pub get + setup-appcenter-cli: # must have node and npm installed! + name: Setup AppCenter CLI + runs-on: self-hosted + steps: + - name: Install appcenter-cli + uses: charliealbright/appcenter-cli-action@v1.0.1 + with: + token: '${{secrets.APPCENTER_API_TOKEN}}' + command: 'appcenter help' + # deploy_iOS: + # name: Deploy iOS + # needs: [setup-flutter, setup-appcenter-cli] + # uses: ./.github/workflows/deploy_ios.yml + deploy_android: + name: Deploy Android + needs: [ setup-flutter, setup-appcenter-cli ] + uses: ./.github/workflows/deploy_android.yml + secrets: inherit + with: + file: './build/app/outputs/apk/release/app-release.apk' + name: 'AlvaroBarrosC/GithubAction-Android' \ No newline at end of file diff --git a/.github/workflows/deploy_android.yml b/.github/workflows/deploy_android.yml new file mode 100644 index 0000000..de09664 --- /dev/null +++ b/.github/workflows/deploy_android.yml @@ -0,0 +1,33 @@ +name: Deploy Android App on AppCenter +on: + workflow_call: + inputs: + file: + description: 'The path to the file to be released' + required: true + type: string + name: + description: 'The name of the app' + required: true + type: string + group: + description: 'The group that will have access to the version released' + required: false + type: string + default: '"Collaborators"' +jobs: + build: + name: Build .apk file + runs-on: self-hosted + steps: + - run: flutter build apk --release --verbose + Deploy: + name: Deploy file to AppCenter + needs: [ build ] + runs-on: self-hosted + steps: + - name: AppCenter CLI Action + uses: charliealbright/appcenter-cli-action@v1.0.1 + with: + token: ${{secrets.APPCENTER_API_TOKEN}} + command: 'appcenter distribute release -f ${{inputs.file}} --app ${{inputs.name}} --group ${{inputs.group}}' \ No newline at end of file diff --git a/.github/workflows/deploy_ios.yml b/.github/workflows/deploy_ios.yml new file mode 100644 index 0000000..f1fb66a --- /dev/null +++ b/.github/workflows/deploy_ios.yml @@ -0,0 +1,16 @@ +name: Deploy iOS App on AppCenter +on: workflow_call +jobs: + Build: + runs-on: self-hosted + steps: + - run: flutter build ipa --release --verbose --no-codesign + # Deploy: + # needs: Build + # runs-on: self-hosted + # steps: + # - name: AppCenter CLI Action + # uses: charliealbright/appcenter-cli-action@v1.0.1 + # with: + # token: '${{secrets.APPCENTER_API_TOKEN}}' + # command: 'appcenter apps show' \ No newline at end of file