Secret Files in Github Actions

Secret Files in Github Actions

When working with sensitive files like google-services.json in a public repository (where anyone can see your code), it's generally not recommended to include them directly. However, if you still need to include such a file, you can follow these steps:

1 : Base64 Encode File

  • Open the folder where google-services.json is located in your terminal.
  • Run the command

openssl base64 < google-services.json | tr -d '\n' | tee google_services.txt

This command converts the google-services.json file into a base64-encoded format and saves it to a file named google_services.txt.

2 : Copy the Encoded Result:

  • After running the command, you'll see a long string of characters in your terminal (the base64-encoded content).
  • Copy this entire string.

3 : Add to Repository Secrets:

  • In your GitHub repository, go to "Settings" > "Secrets" and click on "New repository secret."
  • Paste the copied base64-encoded string into the value field and name it something like GOOGLE_SERVICES_JSON.

4 : Update your workflow yaml

  • In your workflow YAML file (e.g., .github/workflows/main.yml), add the following lines under the appropriate job or step: (fileDir is depend on your folder structure)

Congratulations. You did it.

Win Ko Ko

Mobile Application Developer

8 个月

Such a nice content. Keep it up bro!

Kyaw Linn Thant

Android / Flutter Developer

8 个月

Keep going bro. Waiting new content.

要查看或添加评论,请登录

Kyaw Soe Win的更多文章

  • What are feature flag?

    What are feature flag?

    Feature flags are settings in an app’s code that act like switches, allowing you to turn specific features on or off…

  • Set Icon, URL, and App Name Based on App Flavor

    Set Icon, URL, and App Name Based on App Flavor

    When we develop applications, we often work with different URLs like dev URL or prod URL. In some cases, there might…

  • Localization For Android Applications

    Localization For Android Applications

    Are you still using library or write too much code to change locale for android application? If yes, I would like to…

  • Dependency Injection for Android

    Dependency Injection for Android

    Today, dependency injection is widely adopted across various programming languages and platforms, including Java…

  • Deep Linking ?????????

    Deep Linking ?????????

    Deep Linking ????? User ????????? Action ????????????????? ????????? ?????????? Website ???????? Application Screen…

社区洞察

其他会员也浏览了