77 lines
1.7 KiB
YAML
77 lines
1.7 KiB
YAML
name: Build Plugin
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java 25
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'temurin'
|
|
|
|
- name: Cache Gradle Dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.gradle
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Grant Execute Permission for Gradlew
|
|
run: chmod +x gradlew
|
|
|
|
- name: Build with Gradle
|
|
run: ./gradlew shadowJar
|
|
|
|
- name: Run Tests
|
|
run: ./gradlew test
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: plugin-jar
|
|
path: build/libs/*.jar
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java 25
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'temurin'
|
|
|
|
- name: Grant Execute Permission for Gradlew
|
|
run: chmod +x gradlew
|
|
|
|
- name: Build with Gradle
|
|
run: ./gradlew shadowJar
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: build/libs/*.jar
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|