From c3f078879f8f81df4d4e9103aae1282fa6f73b20 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:15:55 +0200 Subject: [PATCH] refactor(ci-cd): Move prepare keystore out --- .github/actions/prepare-keystore/action.yml | 31 +++++++++++++++++++ ...lease-app.yaml => release-app-github.yaml} | 17 +++------- 2 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 .github/actions/prepare-keystore/action.yml rename .github/workflows/{release-app.yaml => release-app-github.yaml} (51%) diff --git a/.github/actions/prepare-keystore/action.yml b/.github/actions/prepare-keystore/action.yml new file mode 100644 index 0000000..266802f --- /dev/null +++ b/.github/actions/prepare-keystore/action.yml @@ -0,0 +1,31 @@ +name: Prepare KeyStore +description: Write the KeyStore file and properties to disk + +inputs: + signingStorePassword: + description: 'The password for the KeyStore' + required: true + signingKeyPassword: + description: 'The password for the Key' + required: true + signingKeyAlias: + description: 'The alias for the Key' + required: true + +runs: + using: composite + steps: + - name: Write Keystore file 🗄️ + id: android_keystore + uses: timheuer/base64-to-file@v1.0.3 + with: + fileName: key.jks + encodedString: ${{ secrets.KEYSTORE }} + + - name: Write Keystore properties 🗝️ + shell: bash + run: | + echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > key.properties + echo "storePassword=${{ inputs.signingStorePassword }}" >> key.properties + echo "keyPassword=${{ inputs.signingKeyPassword }}" >> key.properties + echo "keyAlias=${{ inputs.signingKeyAlias }}" >> key.properties diff --git a/.github/workflows/release-app.yaml b/.github/workflows/release-app-github.yaml similarity index 51% rename from .github/workflows/release-app.yaml rename to .github/workflows/release-app-github.yaml index c7925d9..5c8bc57 100644 --- a/.github/workflows/release-app.yaml +++ b/.github/workflows/release-app-github.yaml @@ -12,19 +12,12 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Write Keystore file 🗄️ - id: android_keystore - uses: timheuer/base64-to-file@v1.0.3 + - name: Write KeyStore 🗝️ + uses: ./.github/actions/prepare-keystore with: - fileName: key.jks - encodedString: ${{ secrets.KEYSTORE }} - - - name: Write Keystore properties 🗝️ - run: | - echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > key.properties - echo "storePassword=${{ secrets.SIGNING_STORE_PASSWORD }}" >> key.properties - echo "keyPassword=${{ secrets.SIGNING_KEY_PASSWORD }}" >> key.properties - echo "keyAlias=${{ secrets.SIGNING_KEY_ALIAS }}" >> key.properties + signingStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }} + signingKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + signingKeyAlias: ${{ secrets.SIGNING_KEY_ALIAS }} - name: Setup Java uses: actions/setup-java@v3