generated from halo-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add push to maven workflow config (#40)
### What this PR does? 添加发版时自动将工件推送到 Maven 的 workflow 配置 ```release-note None ```
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Publish plugin API module to Maven | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Extract version from GitHub tag | ||
id: extract_version | ||
run: | | ||
tag_name=${{ github.event.release.tag_name }} | ||
VERSION=${tag_name#v} | ||
echo "Extracted Version: $VERSION" | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Build with Gradle | ||
run: ./gradlew clean build -Pversion=${{ env.VERSION }} | ||
|
||
- name: Push to Maven | ||
env: | ||
OSSR_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
OSSR_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | ||
run: ./gradlew :api:publish -Pversion=${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters