Skip to content

Commit

Permalink
Update release node
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarwillymc committed Jan 19, 2024
1 parent 454d305 commit 30935e9
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 35 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ jobs:
BASE_URL_GQL: ${{ secrets.BASE_URL_GQL }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}

run: |
echo "SHARED_PREFERENCES_NAME=$SHARED_PREFERENCES_NAME" >> local.properties
echo "BASE_URL=$BASE_URL" >> local.properties
Expand All @@ -95,26 +94,19 @@ jobs:
else
echo "APP_ID=${{ secrets.APP_ID_RELEASE }}" >> $GITHUB_ENV
fi
# - name: Execute validations
# run: ./gradlew executeValidations
- name: Debug RELEASE_NOTE
run: |
echo "RELEASE_NOTE: $RELEASE_NOTE_TEXT"
echo "APP_ID: $APP_ID"
echo "secretRelease: ${{secrets.APP_ID_RELEASE}}"
echo "secretDebug: ${{secrets.APP_ID_DEBUG}}"
echo "fileroute: app/build/outputs/apk/${{ inputs.buildType || 'debug' }}/app-${{ inputs.buildType || 'debug' }}.apk"
- name: Build App
run: |
if [[ ${{ inputs.buildType || 'debug' }} == "debug" ]]; then
./gradlew assembleDebug
else
./gradlew assembleRelease
fi
- name: Execute validations
run: ./gradlew executeValidations
- name: Build App Release
if: ${{ inputs.buildType || 'debug' }} != "debug"
run: ./gradlew assembleRelease
env:
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}
- name: Build App Debug
if: ${{ inputs.buildType || 'debug' }} == "debug"
run: ./gradlew assembleDebug
env:
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}
- name: upload artifact to Firebase App Distribution
- name: Upload Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ env.APP_ID }}
Expand Down
95 changes: 79 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
name: Generate Release

on:
workflow_dispatch:
inputs:
buildType:
description: 'Build Type'
required: true
default: 'release'
type: choice
options:
- debug
- release
groupTester:
description: 'Testers'
required: true
default: 'production'
type: choice
options:
- all
- qa
- production
releaseNotes:
description: 'Release notes'
required: true
default: 'Update'
type: string
push:
branches:
- main
Expand All @@ -9,13 +33,12 @@ on:
- main

jobs:
config:
generation:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -33,27 +56,67 @@ jobs:

- name: Grant execute permission for gradlew
run: chmod +x gradlew
validations:
runs-on: ubuntu-latest
steps:
- name: Execute validations
run: ./gradlew executeValidations
build:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: Build App
run: ./gradlew assembleRelease appDistributionUploadRelease
- name: Create Google Services File
run: cat /home/runner/work/MBCGroup/MBCGroup/app/google-services.json | base64
- name: Add data Google Services File
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > /home/runner/work/MBCGroup/MBCGroup/app/google-services.json
- name: Configuration Local.properties
env:
SHARED_PREFERENCES_NAME: ${{ secrets.SHARED_PREFERENCES_NAME }}
BASE_URL: ${{ secrets.BASE_URL }}
BASE_URL_GQL: ${{ secrets.BASE_URL_GQL }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
echo "SHARED_PREFERENCES_NAME=$SHARED_PREFERENCES_NAME" >> local.properties
echo "BASE_URL=$BASE_URL" >> local.properties
echo "BASE_URL_GQL=$BASE_URL_GQL" >> local.properties
echo "CLIENT_ID=$CLIENT_ID" >> local.properties
echo "CLIENT_SECRET=$CLIENT_SECRET" >> local.properties
- name: Set RELEASE_NOTE
id: set_release_note
run: |
if [ -z "${{ inputs.releaseNotes }}" ]; then
RELEASE_NOTE=$(cat release_notes.txt)
else
RELEASE_NOTE="${{ inputs.releaseNotes }}"
fi
echo "RELEASE_NOTE_TEXT<<EOF" >> $GITHUB_ENV
echo $RELEASE_NOTE >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Set App ID
id: set_app_id
run: |
if [[ "${{ inputs.buildType || 'release' }}" == "release" ]]; then
echo "APP_ID=${{ secrets.APP_ID_RELEASE }}" >> $GITHUB_ENV
else
echo "APP_ID=${{ secrets.APP_ID_DEBUG }}" >> $GITHUB_ENV
fi
- name: Execute validations
run: ./gradlew executeValidations
- name: Build App Release
if: ${{ inputs.buildType || 'release' }} == "release"
run: ./gradlew assembleRelease
env:
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}
TESTERS_GROUP: ${{ secrets.TESTERS_GROUP }}
- name: Build App Debug
if: ${{ inputs.buildType || 'release' }} != "release"
run: ./gradlew assembleDebug
env:
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}
- name: Upload Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ env.APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_TOKEN }}
groups: ${{ inputs.groupTester || 'production' }}
releaseNotes: ${{ env.RELEASE_NOTE_TEXT }}
file: app/build/outputs/apk/${{ inputs.buildType || 'release' }}/app-${{ inputs.buildType || 'release' }}.apk
debug: true
- name: Upload APK artifact
uses: actions/upload-artifact@v2
with:
name: app-release
path: app/build/outputs/apk/release/app-release.apk
name: app-${{ inputs.buildType || 'release' }}
path: app/build/outputs/apk/${{ inputs.buildType || 'release' }}/app-${{ inputs.buildType || 'release' }}.apk

0 comments on commit 30935e9

Please sign in to comment.