Release 6.0.5 #7
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: UltiTools API CI with Maven | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'UltiTools-API/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B package -Dmaven.javadoc.skip=true --file UltiTools-API/pom.xml | |
- name: Get Project Version from pom.xml | |
id: version | |
uses: avides/actions-project-version-check@v1.4.0 | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
file-to-check: UltiTools-API/pom.xml | |
only-return-version: true | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4.0.0 | |
with: | |
name: ultitools-artifact | |
path: UltiTools-API/target/UltiTools-API-${{ steps.version.outputs.version }}.jar | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Project Version from pom.xml | |
id: version | |
uses: avides/actions-project-version-check@v1.4.0 | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
file-to-check: UltiTools-API/pom.xml | |
only-return-version: true | |
- name: Download artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: ultitools-artifact | |
- name: Get Latest Merged PR | |
id: get-pr | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const { data: pullRequests } = await github.rest.pulls.list({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'closed', | |
sort: 'updated', | |
direction: 'desc', | |
per_page: 1 | |
}); | |
const mergedPR = pullRequests.find(pr => pr.merged_at); | |
return { | |
title: mergedPR.title, | |
body: mergedPR.body | |
}; | |
result-encoding: json | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
tag_name: v${{ steps.version.outputs.version }} | |
release_name: Release ${{ steps.version.outputs.version }} | |
body: | | |
# ${{ steps.get-pr.outputs.title }} | |
${{ steps.get-pr.outputs.body }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./UltiTools-API/target/UltiTools-API-${{ steps.version.outputs.version }}.jar | |
asset_name: UltiTools-API-${{ steps.version.outputs.version }}.jar | |
asset_content_type: application/java-archive | |