> When that run is complete, you should see a g...
# touchlab-tools
j
When that run is complete, you should see a green result. If not, please reach out :)
I’m trying out KmmBridge by following this and this
##[error]Resource not accessible by integration
comes up when running the github action.
r
I don't recognize that particular error, but this looks wrong:
Copy code
2023-06-16T21:03:27.0871000Z ##[group]GITHUB_TOKEN Permissions
2023-06-16T21:03:27.0871820Z Contents: read
2023-06-16T21:03:27.0872210Z Metadata: read
2023-06-16T21:03:27.0872940Z Packages: read
You'll need write permission for packages and contents for the publish flow to work.
j
I found a few issues related to my gradle file too. I have a custom maven declaration to access a package on a github repo :
Copy code
credentials {
    username = System.getenv("GITHUB_USERNAME")
    password = System.getenv("GITHUB_TOKEN")
}
And turned out Github Actions do not allow secrets starting with
GITHUB
. That was the first thing. I changed them to
ACTIONS_...
instead but now I’m facing this erro :
Copy code
Invalid secret, ACTIONS_USERNAME is not defined in the referenced workflow. .github/workflows/kmmbridgepnblish.yml (Line: 12, Col: 22): 
Invalid secret, ACTIONS_TOKEN is not defined in the referenced workflow.
I’ve tried a bunch a different thing in the yml file but haven’t figured it out yet
r
try passing them as netrc params. Our github workflow will configure a netrc file with machine
<http://maven.pkg.github.com|maven.pkg.github.com>
(configurable with the
netrcMachine
input), and uses the
netrcUsername
and
netrcPassword
secrets as credentials.
j
Do you have an example of how to do that? I tried this but I still get an error
Could not get resource […] Username must not be null!
r
Try something like this
Copy code
jobs:
  call-kmmbridge-publish:
    permissions:
      contents: write
      packages: write
    uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildbranches.yml@v0.9
    secrets:
      netrcUsername:  ${{ secrets.ACTIONS_USERNAME }}
      netrcPassword: ${{ secrets.ACTIONS_TOKEN }}
j
I’m still getting
Username must not be null!
I uploaded my library to maven central, removing the need for username/password. But now I get the following error :
Copy code
> Could not PUT '<https://maven.pkg.github.com/jeantuffier/Tavla-Common/no/entur/tavla/CommonTavla-kmmbridge/0.1.0.1/CommonTavla-kmmbridge-0.1.0.1.zip|https://maven.pkg.github.com/jeantuffier/Tavla-Common/no/entur/tavla/CommonTavla-kmmbridge/0.1.0.1/CommonTavla-kmmbridge-0.1.0.1.zip>'. Received status code 422 from server: Unprocessable Entity
r
That looks like you're still trying to publish to github maven
j
The error came from kmm-brigde github action. Seems like github packages doesn’t like uppercases, replacing them with lowercases fixed the issue
I managed all the different issues I had but now I’m having difficulties with versioning. Kmm-bridge manage to publish my library to github package but it does it to times with the same package name. Which make the process failed with a conflict error.
Copy code
Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not PUT '<https://maven.pkg.github.com/jeantuffier/Tavla-Common/no/entur/tavla/common-tavla-kmmbridge/0.1.1.1/common-tavla-kmmbridge-0.1.1.1.zip>'. Received status code 409 from server: Conflict
It also adds a “.1” to my version. I have this in my gradle file
Copy code
kmmbridge {
    mavenPublishArtifacts()
    githubReleaseVersions()
    spm()
    addGithubPackagesRepository()
}
r
The versioning is coming from using githubReleaseVersions. That will append an auto-incrementing dot version that it manages by watching what the latest github release was. See more docs on version management here https://kmmbridge.touchlab.co/docs/general/CONFIGURATION_OVERVIEW#version-managers I don't think I understand the double publishing issue without seeing more of what you're doing.
j
Right, I added the missing
versionPrefix.set("0.1")
to my configuration and it seems like its not trying to publish the package two times. Instead I get this error now :
Copy code
org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':publishKMMBridgeFrameworkPublicationToGithubRepository' (type 'PublishToMavenRepository').
  - In plugin 'org.gradle.api.publish.maven.plugins.MavenPublishPlugin$Inject' type 'org.gradle.api.publish.maven.tasks.PublishToMavenRepository' property 'credentials.username' doesn't have a configured value.
Even though it did manage to publish a package