Publish to Maven central from GitHub workflow #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI | |
on: [push] | |
jobs: | |
build_faiss: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
submodules: true | |
- uses: whoan/docker-build-with-cache-action@v5 | |
with: | |
username: ${{ github.actor }} | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
registry: docker.pkg.github.com | |
#or | |
#registry: ghcr.io | |
image_name: jfaiss-cpu | |
dockerfile: Dockerfile | |
# - name: Run the docker image | |
# uses: ./.github/actions | |
# - name: Debugging with tmate | |
# uses: mxschmitt/action-tmate@v3 | |
# - run: docker image ls | |
- run: docker run -v "/home/runner/work/jfaiss-cpu/jfaiss-cpu":"/github/workspace" docker.pkg.github.com/criteo/jfaiss-cpu/jfaiss-cpu | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: faiss_JNI_and_SO | |
path: build | |
build: | |
needs: build_faiss | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Download build | |
uses: actions/download-artifact@v4 | |
with: | |
name: faiss_JNI_and_SO | |
path: build_copy | |
- name: Move | |
run: | | |
rm -rf src/main/java/com/vectorsearch/faiss/swig | |
cp -r build_copy/java/com/vectorsearch/faiss/swig src/main/java/com/vectorsearch/faiss/swig | |
rm -rf src/main/resources | |
cp -r build_copy/resources src/main/resources | |
- name: Publish package | |
run: mvn --batch-mode deploy | |
env: | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |