Skip to content

test3

test3 #3

Workflow file for this run

# 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/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload JAR as artifact
uses: actions/upload-artifact@v4
with:
name: plugin-jar
path: target/*.jar # Path to the JAR in the target directory
push-jar-to-repo:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Commit JAR file
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
cp target/*.jar .
git add *.jar
git commit -m "Add built JAR file"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}