mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 11:57:12 +02:00
Add a test GitHub Actions workflow to publish to a GitHub repository, Maven repository, and GitHub Pages
This commit is contained in:
parent
bc90a15a68
commit
98b794ca2b
127
.github/workflows/test.yml
vendored
Normal file
127
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
name: Release Artifacts to Maven Central
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "gh-actions" ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '17'
|
||||||
|
distribution: 'temurin'
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
|
- name: maven-settings-xml-action
|
||||||
|
uses: whelk-io/maven-settings-xml-action@v22
|
||||||
|
with:
|
||||||
|
servers: '[{ "id": "${repo.id}", "username": "${repo.user}", "password": "${repo.pass}" }]'
|
||||||
|
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
- run: cd docs && npm ci
|
||||||
|
- run: cd docs && npm run build
|
||||||
|
|
||||||
|
- name: Find and Replace
|
||||||
|
uses: jacobtomlinson/gha-find-replace@v3
|
||||||
|
with:
|
||||||
|
find: "ollama4j-revision"
|
||||||
|
replace: ${{ github.ref_name }}
|
||||||
|
regex: false
|
||||||
|
|
||||||
|
- name: Find and Replace
|
||||||
|
uses: jacobtomlinson/gha-find-replace@v3
|
||||||
|
with:
|
||||||
|
find: "mvn-repo-id"
|
||||||
|
replace: central
|
||||||
|
regex: false
|
||||||
|
|
||||||
|
- name: Import GPG key
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
- name: List keys
|
||||||
|
run: gpg -K
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn --file pom.xml -U clean package -Punit-tests && cp -r ./target/apidocs/. ./docs/build/apidocs
|
||||||
|
|
||||||
|
- name: Doxygen Action
|
||||||
|
uses: mattnotmitt/doxygen-action@v1.1.0
|
||||||
|
with:
|
||||||
|
doxyfile-path: "./Doxyfile"
|
||||||
|
working-directory: "."
|
||||||
|
|
||||||
|
- name: Publish to Maven Central
|
||||||
|
run: mvn deploy -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Drepo.id=central -Drepo.user=${{ secrets.MVN_USER }} -Drepo.pass=${{ secrets.MVN_PASS }}
|
||||||
|
|
||||||
|
- name: Upload Release Asset - JAR
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: target/ollama4j-${{ github.ref_name }}.jar
|
||||||
|
asset_name: ollama4j-${{ github.ref_name }}.jar
|
||||||
|
asset_content_type: application/x-jar
|
||||||
|
|
||||||
|
- name: Upload Release Asset - Javadoc JAR
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: target/ollama4j-${{ github.ref_name }}-javadoc.jar
|
||||||
|
asset_name: ollama4j-${{ github.ref_name }}-javadoc.jar
|
||||||
|
asset_content_type: application/x-jar
|
||||||
|
|
||||||
|
- name: Upload Release Asset - Sources JAR
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: target/ollama4j-${{ github.ref_name }}-sources.jar
|
||||||
|
asset_name: ollama4j-${{ github.ref_name }}-sources.jar
|
||||||
|
asset_content_type: application/x-jar
|
||||||
|
|
||||||
|
- name: Publish to GitHub Packages Apache Maven
|
||||||
|
run: mvn deploy -Punit-tests -s $GITHUB_WORKSPACE/settings.xml -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Drepo.id=github -Drepo.user=${{ secrets.GH_MVN_USER }} -Drepo.pass=${{ secrets.GH_MVN_PASS }} -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/ollama4j/ollama4j
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
# Upload entire repository
|
||||||
|
path: './docs/build/.'
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
|
|
||||||
|
- name: Release message
|
||||||
|
run: |
|
||||||
|
echo "### Released version: ${{ github.ref_name }} 🚀" >> $GITHUB_STEP_SUMMARY
|
Loading…
x
Reference in New Issue
Block a user