67 lines
2.0 KiB
YAML
67 lines
2.0 KiB
YAML
name: Java Build and Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- 'README*.md'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
|
|
- name: Install the dependency
|
|
run: mvn install:install-file -DgroupId=me.clip -DartifactId=placeholderapi -Dversion=2.11.2 -Dpackaging=jar -Dfile=lib/placeholderapi-2.11.2.jar
|
|
|
|
- name: Build with Maven
|
|
run: mvn -B package --file pom.xml
|
|
|
|
- name: Capture Build Artifacts
|
|
uses: actions/[email protected]
|
|
with:
|
|
name: Artifacts
|
|
path: target/
|
|
|
|
- name: Get Plugin Version
|
|
id: get_version
|
|
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
|
|
- name: Get Plugin Name
|
|
id: get_name
|
|
run: echo "PROJECT_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)" >> $GITHUB_ENV
|
|
|
|
- name: Create GitHub Release
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: v${{ env.PROJECT_VERSION }}
|
|
release_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}
|
|
|
|
- name: Upload Artifact to GitHub Release
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./target/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}.jar
|
|
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}.jar
|
|
asset_content_type: application/java-archive
|