Skip to content

Commit

Permalink
CI - updated Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Teyssier committed Mar 11, 2024
1 parent fff98a0 commit 5926d6f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 40 deletions.
47 changes: 7 additions & 40 deletions .github/workflows/build-deploy-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,26 @@ name: Build App & Deploy Internal
on:
push:
branches: [develop]
pull_request:
branches: [develop]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:

- name: Checkout the code
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: oracle
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Decode Base64 Keystore
env:
KEYSTORE_BASE64: ${{ secrets.ANDROID_SIGNING_KEYSTORE }}
run: echo $KEYSTORE_BASE64 | base64 --decode > keystore.jks
working-directory: ./app

- name: Get current date for version code
id: date
run: echo "::set-output name=date::$(date +'%y%m%d%H%M')"

- name: Assemble & Sign App Release Bundle
env:
ONELIST_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEYSTORE_PASSWORD }}
ONELIST_KEYSTORE_ALIAS: ${{ secrets.ONELIST_KEYSTORE_ALIAS }}
ONELIST_KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ONELIST_KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew bundleRelease

- name: Upload aab
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: app/build/outputs/bundle/release/app-release.aab
uses: ./.github/workflows/common-build-workflow.yml
secrets: inherit
with:
upload-artifact: true


deploy:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:

- name: Checkout the code
uses: actions/checkout@v3

- name: Download aab
uses: actions/download-artifact@v4
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build App

on:
pull_request:
branches: [develop]
workflow_dispatch:

jobs:
build:
name: Build
uses: ./.github/workflows/common-build-workflow.yml
secrets: inherit
with:
upload-artifact: false
58 changes: 58 additions & 0 deletions .github/workflows/common-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build App & Deploy Internal

on:
workflow_call:
inputs:
upload-artifact:
required: true
type: boolean

jobs:
build:
runs-on: ubuntu-latest
name: Build App
steps:

- name: Checkout the code
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: oracle
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Decode Base64 Keystore
env:
KEYSTORE_BASE64: ${{ secrets.ANDROID_SIGNING_KEYSTORE }}
run: echo $KEYSTORE_BASE64 | base64 --decode > keystore.jks
working-directory: ./app

- name: Prepare Version Code
id: versionCode
run: |
sum=`expr ${{vars.VERSION_CODE_OFFSET}} + ${{github.run_number}}`
echo "versionCode=$sum" >> "$GITHUB_OUTPUT"
- name: Prepare version.properties
run: |
touch version.properties && \
echo "VERSION_CODE=${{ steps.versionCode.outputs.versionCode }}" >> version.properties
- name: Assemble & Sign App Release Bundle
env:
ONELIST_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEYSTORE_PASSWORD }}
ONELIST_KEYSTORE_ALIAS: ${{ secrets.ONELIST_KEYSTORE_ALIAS }}
ONELIST_KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ONELIST_KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew bundleRelease

- name: Upload aab
if: inputs.upload-artifact
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: app/build/outputs/bundle/release/app-release.aab

0 comments on commit 5926d6f

Please sign in to comment.