[ci skip]Create main.yml
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
name: Java Build and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- 'README*.md'
|
||||||
|
|
||||||
|
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: Build with Maven
|
||||||
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
|
- name: Capture Build Artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user