Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Publish maven package to GitHub Packages

on:
push:
branches: [master, ci]
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
cache: 'maven'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml

- name: Build with Maven
run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml -B package --file pom.xml
env:
USER_NAME: ${{ secrets.PACKAGES_USERNAME }}
ACCESS_TOKEN: ${{ secrets.PACKAGES_ACCESS_TOKEN }}

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml
env:
USER_NAME: ${{ secrets.PACKAGES_USERNAME }}
ACCESS_TOKEN: ${{ secrets.PACKAGES_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

- uses: actions/upload-artifact@v4.0.0
with:
name: TesseractCore
retention-days: 15
overwrite: true
path: |
/home/runner/work/TesseractCore/TesseractCore/target/*.jar
!/home/runner/work/TesseractCore/TesseractCore/target/*sources.jar
!/home/runner/work/TesseractCore/TesseractCore/target/original*.jar
38 changes: 38 additions & 0 deletions .github/workflows/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/TesseractFR/CommandBuilder</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>${env.USER_NAME}</username>
<password>${env.ACCESS_TOKEN}</password>
</server>
</servers>

</settings>
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/TesseractFR/TesseractCore</url>
</repository>
</distributionManagement>

<build>
<defaultGoal>clean package</defaultGoal>
<sourceDirectory>src/main/kotlin</sourceDirectory>
Expand Down