How to use GitHub Packages with CircleCI

I am using CircleCI for a project that relies on a library that is hosted on GitHub package. My builds keep failing even after providing require git credentials required for installing GitHub hosted packages.

Any help with this will be appreciated.

Here is my complete log:

     Task :neat-form-core:androidDependencies FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':neat-form-core:androidDependencies'.
> Could not resolve all artifacts for configuration ':neat-form-core:debugCompileClasspath'.
   > Could not resolve com.nerdstone:neat-android-stepper:1.0.0.
     Required by:
         project :neat-form-core
      > Could not resolve com.nerdstone:neat-android-stepper:1.0.0.
         > Could not get resource 'https://maven.pkg.github.com/********/neat-android-stepper/com/nerdstone/neat-android-stepper/1.0.0/neat-android-stepper-1.0.0.pom'.
            > Could not GET 'https://maven.pkg.github.com/********/neat-android-stepper/com/nerdstone/neat-android-stepper/1.0.0/neat-android-stepper-1.0.0.pom'. Received status code 400 from server: Bad Request
      > Could not resolve com.nerdstone:neat-android-stepper:1.0.0.
         > Could not get resource 'https://maven.pkg.github.com/********/neat-android-stepper/com/nerdstone/neat-android-stepper/1.0.0/neat-android-stepper-1.0.0.pom'.
            > Could not GET 'https://maven.pkg.github.com/********/neat-android-stepper/com/nerdstone/neat-android-stepper/1.0.0/neat-android-stepper-1.0.0.pom'. Received status code 400 from server: Bad Request

I guess I will have to answer my question since I got the solution that might be helpful to someone experiencing the same.

Step 1: So First you need to set 2 environment variables on CircleCI for your GIT_USER_ID and another for GIT_PERSONAL_ACCESS token.

Step2: Add this command to your steps just before running the task for donwloading Android dependencies
- run:
name: Create local.properties file
command: printf “gpr.usr=$GIT_USER_ID\ngpr.key=$GIT_PERSONAL_ACCESS” >> ~/code/local.properties

This will create a local.properties file for your build and pass the content of the environment variable.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.