ilharp / sign-android-release

A GitHub action to sign an APK or AAB
https://github.com/marketplace/actions/sign-android-release-2
MIT License
43 stars 10 forks source link

Cannot find signingKey/ANDROID_SIGNING_KEY #12

Closed PainterHalver closed 1 year ago

PainterHalver commented 1 year ago

I've set the secrets and checked that decoded base64 keystore is exactly the same as the original, but still cannot find signing key.

yml:

name: "Release Build"

on:
  push:
    tags:
      - "v*"

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up JDK 17
        uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: '17.x'
      - name: Make gradlew executable
        run: chmod +x ./gradlew
      - name: Build apk
        run: ./gradlew assembleRelease
      - uses: ilharp/sign-android-release@v1
        name: Sign app APK
        id: sign_app
        with:
          releaseDir: app/build/outputs/apk/release
          signingKey: ${{ secrets.ANDROID_SIGNING_KEY }}
          keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}
          keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
          keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
          buildToolsVersion: 33.0.0
      - name: Rename to app-release.apk
        run: mv ${{steps.sign_app.outputs.signedFile}} app-release.apk
      - name: Publish release APK
        uses: actions/upload-artifact@v3
        with:
          name: Signed app bundle
          path: app-release.apk

image

All secrets set: image

PainterHalver commented 1 year ago

Welp, me bad. Turns out I should set the Repository secrets instead of Environment secrets

raviSussol commented 1 year ago

@PainterHalver @ilharp

I've added ANDROID_SIGNING_KEY in the repository secret under actions section of Secrets and variables sidebar of which it contains the base64 of my my-upload-keystore.keystore file. I generated base64 encoded text by running

openssl base64 < my-upload-key.keystore | tr -d '\n' | tee my-upload-key.keystore.base64.txt

But I'm still getting the same error as above. What could possibly go wrong in my case? Could you guys please help me to resolve it?

Screenshot 2023-08-01 at 6 09 06 AM
ilharp commented 1 year ago

image

image

When using strings that look alike, I always recommend copy-pasting instead of typing.

raviSussol commented 1 year ago

Thanks @ilharp for the quick reply. Now it is working for me too. The issue was the secret env variables need to be defined as required in the workflow (like in your above screenshot says "Required").

...
on:
  workflow_dispatch
     secrets:
        ANDROID_SIGNING_KEY:
           required: true
        ...

Not sure if this needs to be mentioned in your Readme.md file?

ilharp commented 1 year ago

In theory, you only need to define these secrets in Repository Secrets, and then reference them in job.steps. No other additional configuration is required.

You can search other repositories for usage examples. For example:

https://github.com/ReVanced/revanced-manager/blob/001122237193a1afa6937f0ec578f2afe56d01b7/.github/workflows/release.yml

raviSussol commented 1 year ago

Yeah you're right. Doesn't require anything after setting secrets to the github action. Actually my workflow is a bit different than others or you're mentioned linked projects. I've got several workflow files for specific platform (android, ios, ...) and I'd been trying to get ANDROID_SIGNING_KEY value from the workflow_call workflow file. And that could've been the issue I think. In the workflow_dispatch file, getting secrets just work.

Thanks for your help. All clear now. 👍