Skip to content

📦 project api config #4

📦 project api config

📦 project api config #4

Workflow file for this run

name: Publish package to the Maven Central Repository and GitHub Packages
'on':
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v1
with:
java-version: '8'
distribution: 'zulu'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: mvn -DskipTests --batch-mode deploy -Possrh
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE}}
github_publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
server-id: github_auth
- name: Publish package
run: mvn -DskipTests --batch-mode deploy -P github_auth
env:
GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}
# publish:
# # 任务运行的环境
# runs-on: ubuntu-latest
# # 任务的步骤
# steps:
# # 1. 声明 checkout 仓库代码到工作区
# - name: Checkout Git Repo
# uses: actions/checkout@v2
# # 2. 安装Java 环境 这里会用到的参数就是 Git Action secrets中配置的,
# # 取值要在key前面加 secrets.
# - name: Set up Maven Central Repo
# uses: actions/setup-java@v1
# with:
# java-version: 1.8
# server-id: ossrh
# server-username: ${{ secrets.OSSRH_USERNAME }}
# server-password: ${{ secrets.OSSRH_PASSWORD }}
# gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
# # 3. 发布到Maven中央仓库
# - name: Publish to Maven Central Repo
# # 这里用到了其他人写的action脚本,详细可以去看他的文档。
# run: mvn -DskipTests --batch-mode deploy -P ossrh
# uses: samuelmeuli/action-maven-publish@v1
# with:
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
# nexus_username: ${{ secrets.OSSRH_USER }}
# nexus_password: ${{ secrets.OSSRH_USERNAME }}
# uses: actions/setup-java@v3
# with:
# java-version: '11'
# distribution: 'adopt'
# - name: Publish to GitHub Packages
# run: mvn -DskipTests --batch-mode deploy -P github_auth
# env:
# GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# java-version: '8'
# distribution: 'zulu'
# server-id: github_auth
# - name: Publish package
# run: mvn -DskipTests --batch-mode deploy -P github_auth
# env:
# GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}