zhangyuheng
99125fa924
All checks were successful
Java CI-CD with Gradle / build (push) Successful in 25m57s
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
name: Java CI-CD with Gradle
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
build:
|
|
# 配置权限
|
|
permissions: write-all
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
cache: gradle
|
|
- name: "Build with Gradle"
|
|
run: ./gradlew buildPlugin
|
|
- name: "Copy jar to staging"
|
|
run: mkdir staging && cp build/libs/*.jar staging/
|
|
# 设置 jobs Maven pom 版本环境变量
|
|
- name: Set Release version env variable
|
|
run: |
|
|
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
- name: "Build & test"
|
|
run: |
|
|
echo "done!"
|
|
- uses: "marvinpinto/action-automatic-releases@latest"
|
|
with:
|
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
automatic_release_tag: "latest"
|
|
prerelease: false
|
|
title: "Release ${{ env.RELEASE_VERSION }}"
|
|
files: |
|
|
staging/*.jar
|