|
| 1 | +name: Create Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: master |
| 5 | + tags: |
| 6 | + - v* |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + release_build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + if: startsWith(github.ref, 'refs/tags/') |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4.1.1 |
| 18 | + |
| 19 | + - name: Setup JDK |
| 20 | + uses: actions/setup-java@v3.13.0 |
| 21 | + with: |
| 22 | + java-version: '11' |
| 23 | + distribution: 'temurin' |
| 24 | + cache: gradle |
| 25 | + |
| 26 | + - name: Create local gradle properties files |
| 27 | + run: touch local.properties |
| 28 | + |
| 29 | + - name: Add Google Maps API Key |
| 30 | + run: echo "MAPS_API_KEY=${{secrets.MAPS_API_KEY}}" >> local.properties |
| 31 | + |
| 32 | + # Here we need to decode keystore.jks from base64 string and place it |
| 33 | + # in the folder specified in the release signing configuration |
| 34 | + - name: Decode Keystore |
| 35 | + id: decode_keystore |
| 36 | + uses: timheuer/base64-to-file@v1.2.3 |
| 37 | + with: |
| 38 | + fileName: 'android_keystore.jks' |
| 39 | + fileDir: '/home/runner/work/<<project name>>/<<project name>>/app/keystore/' |
| 40 | + encodedString: ${{ secrets.SIGNING_KEYSTORE }} |
| 41 | + |
| 42 | + - name: Build Release APK |
| 43 | + env: |
| 44 | + SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} |
| 45 | + SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} |
| 46 | + SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} |
| 47 | + run: ./gradlew build -x lint -x lintVitalRelease |
| 48 | + |
| 49 | + - name: Build Release Bundle |
| 50 | + run: ./gradlew bundleRelease |
| 51 | + env: |
| 52 | + SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} |
| 53 | + SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} |
| 54 | + SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} |
| 55 | + |
| 56 | + - name: Upload Build to artifacts |
| 57 | + uses: actions/upload-artifact@v3.1.3 |
| 58 | + with: |
| 59 | + name: release-artifacts |
| 60 | + path: | |
| 61 | + app/build/outputs/debug/app-debug.apk |
| 62 | + app/build/outputs/bundle/release/ |
| 63 | + |
| 64 | + - name: Create Github Release |
| 65 | + uses: softprops/action-gh-release@v1 |
| 66 | + with: |
| 67 | + generate_release_notes: true |
| 68 | + prerelease: true |
| 69 | + files: | |
| 70 | + app/build/outputs/apk/debug/app-debug.apk |
| 71 | + app/build/outputs/bundle/release/app-release.aab |
0 commit comments