diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c743be3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Publish Release to GitHub + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + + - name: Extract version from tag + id: vars + run: | + TAG_NAME=${GITHUB_REF##*/} + if [[ ! "$TAG_NAME" =~ ^v[0-9]+(\.[0-9]+)*$ ]]; then + echo "Invalid tag format: $TAG_NAME" + exit 1 + fi + VERSION=${TAG_NAME#v} + echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Build JAR + run: mvn -B clean package -DskipTests=true -Drevision=${{ steps.vars.outputs.version }} + + - name: Upload JAR to GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: target/owlapi-wrapper-${{ steps.vars.outputs.version }}.jar + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/pom.xml b/pom.xml index 5573d49..618becb 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.stanford.ncbo.oapiwrapper owlapi-wrapper - 1.4.3-SNAPSHOT + ${revision} jar owlapi_wrapper @@ -99,6 +99,7 @@ + 1.4.3-SNAPSHOT UTF-8 @@ -217,11 +218,14 @@ + + org.jacoco