diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2303511..b3cc085 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,41 +4,39 @@ name: CD - Create a new release # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - push: - tags: - - "v*.*.*" # on every version tag will build a new android artifact. + push: + tags: + - "v*.*.*" # on every version tag will build a new android artifact. jobs: - build: - name: Build APK - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Setup Java - uses: actions/setup-java@v1 - with: - java-version: "12.x" - - name: Setup Flutter - uses: subosito/flutter-action@v1 - with: - flutter-version: "3.3.0" + build: + name: Build APK + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: "12.x" + - name: Setup Flutter + uses: subosito/flutter-action@v1 + with: + flutter-version: "3.3.0" - - name: Pub Get Packages - run: flutter pub get + - name: Pub Get Packages + run: flutter pub get - - name: Build APK - env: - KEY_PROP: ${{ secrets.KEY_PROP }} - KEY_JKS: ${{ secrets.KEY_JKS }} - KEY_PASSWORD: ${{ secrets.ALIAS_PASSWORD }} - ALIAS_PASSWORD: ${{ secrets.KEY_PASSWORD }} - run: echo $KEY_JKS | base64 --decode > upload-keystore.jks && echo $KEY_PROP| base64 --decode > ./android/key.properties && flutter pub get && flutter build apk --release --dart-define=SERVER_IP_PROD=${{ secrets.SERVER_IP_PROD }} --dart-define=PORT_PROD=${{ secrets.PORT_PROD }} - - - name: Create Github Release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - name: Careot release ${{ github.ref_name }} - files: | - build/app/outputs/apk/release/*.apk - + - name: Build APK + env: + STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + KEY_JKS: ${{ secrets.KEY_JKS }} + run: echo $KEY_JKS | base64 --decode > upload-keystore.jks && && flutter pub get && flutter build apk --release --dart-define=SERVER_IP_PROD=${{ secrets.SERVER_IP_PROD }} --dart-define=PORT_PROD=${{ secrets.PORT_PROD }} + + - name: Create Github Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: Careot release ${{ github.ref_name }} + files: | + build/app/outputs/apk/release/*.apk diff --git a/android/app/build.gradle b/android/app/build.gradle index 8e4a029..4c37a2c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -62,10 +62,10 @@ android { signingConfigs { release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null - storePassword keystoreProperties['storePassword'] + storeFile file("../upload-keystore.jks") + keyAlias = "upload" + keyPassword System.getenv('KEY_PASSWORD') ?: keystoreProperties['keyPassword'] + storePassword System.getenv('STORE_PASSWORD') ?: keystoreProperties['storePassword'] } } buildTypes {