mirror of
https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
synced 2026-03-22 06:15:10 +08:00
feat(流水线): github的流水线配置
This commit is contained in:
58
.github/workflows/release.yml
vendored
58
.github/workflows/release.yml
vendored
@@ -1,25 +1,53 @@
|
||||
name: Maven Central Repo Deployment
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [released]
|
||||
jobs:
|
||||
publish:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Git Repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Maven Central Repo
|
||||
# 拉取源码
|
||||
- uses: actions/checkout@v2
|
||||
# 安装JDK环境
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
server-id: sonatype-nexus-staging
|
||||
server-username: ${{ secrets.OSSRH_USER }}
|
||||
server-password: ${{ secrets.OSSRH_PASSWORD }}
|
||||
gpg-passphrase: ${{ secrets.GPG_PASSWORD }}
|
||||
- name: Publish to Maven Central Repo
|
||||
uses: samuelmeuli/action-maven-publish@v1
|
||||
# 设置Maven中央仓库配置
|
||||
- name: Set up Apache Maven Central
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_SECRET }}
|
||||
gpg_passphrase: ${{ secrets.GPG_PASSWORD }}
|
||||
nexus_username: ${{ secrets.OSSRH_USER }}
|
||||
nexus_password: ${{ secrets.OSSRH_PASSWORD }}
|
||||
java-version: 1.8
|
||||
server-id: releases
|
||||
# Nexus用户名环境变量
|
||||
server-username: MAVEN_USERNAME
|
||||
# Nexus密码环境变量
|
||||
server-password: MAVEN_CENTRAL_TOKEN
|
||||
# gpg短密码环境变量
|
||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE
|
||||
# gpg私钥
|
||||
gpg-private-key: ${{ secrets.GPG_SECRET }}
|
||||
# 推送jar包至maven中央仓库
|
||||
- name: Publish to Apache Maven Central
|
||||
# 执行maven deploy命令
|
||||
run: mvn clean deploy
|
||||
# 环境变量设置
|
||||
env:
|
||||
# Nexus用户名,如果觉得不想暴露也可以配置到secrets中
|
||||
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
|
||||
# Nexus密码
|
||||
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_PASSWORD }}
|
||||
# gpg短密码
|
||||
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
|
||||
# Nexus自动部署
|
||||
- name: Release on nexus
|
||||
uses: monkeyWie/maven-nexus-release@v1
|
||||
with:
|
||||
# Nexus用户名
|
||||
maven-repo-server-username: ${{ secrets.OSSRH_USER }}
|
||||
# Nexus密码
|
||||
maven-repo-server-password: ${{ secrets.OSSRH_PASSWORD }}
|
||||
15
pom.xml
15
pom.xml
@@ -101,22 +101,21 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.8</version>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
<version>0.7.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>false</autoReleaseAfterClose>
|
||||
<publishingServerId>central</publishingServerId>
|
||||
<autoPublish>true</autoPublish>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
Reference in New Issue
Block a user