I have two repositories with Java Maven projects in it:
I've set a Github Action to compile each repository with maven on pull. For the first this works without issue. For the second one this doesn't work because the projects of the first repository aren't available to maven in the environment when building the second one.
I've had two ideas to solve this issue
Both solutions would probably work but would end up needing all the build time to build the first repository additionally.
This is the Github action (currently same in both repositories):
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn package --file pom.xml
Is there some way to use the build of the first repository in the second repository without building it againg?
I suppose that this is'nt a unique problem and there must be a best practise solution.
Is there some way to use the build of the first repository in the second repository without building it againg?
I don't think there is any such feature to share build output between workflows in different repositories. In my opinion, best practice would be to release a versioned artifact from the first project which the second project depends on and can fetch from a Maven repository.
Maybe you don't want to release the artifact to the public Maven repository and you might not have access to a private one. In that case, you could use GitHub Package Registry. It's in beta right now so you would need to sign up if you don't already have access. That would allow you to create a private Maven repository to share the versioned artifact.
https://github.com/features/package-registry
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With