Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-xiaowu committed Mar 6, 2023
1 parent e28c8a6 commit 60e75b1
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 62 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/auto-merge.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build And Release

on:
push:
branches:
- master
jobs:
build:
# 配置权限
permissions: write-all
runs-on: ubuntu-latest
steps:
# 下载代码
- uses: actions/checkout@v3
- name: Set up JDK 17
# 安装 JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
# 配置 settings.xml 一般用于 Mavne 私库验证等
# - name: maven-settings-xml-action
# uses: whelk-io/maven-settings-xml-action@v20
# with:
# repositories: ''
# servers: ''
# Maven 打包
- name: Build with Maven
run: mvn clean package -DskipTests -Prelease -fpom.xml
# 将打包好的 Jar 包 放到 staging 文件夹
- run: mkdir staging && cp target/*.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!"
# 上传文件并发布 Release
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.RELEASE_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "Release ${{ env.RELEASE_VERSION }}"
files: |
staging/*.jar
27 changes: 14 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,34 @@ name: Maven Central Repo Deployment
# 触发脚本的事件 这里为发布release之后触发
on:
release:
types: [released]
types:
- released
# 定义一个发行任务
jobs:
publish:
# 任务运行的环境
# 任务运行的环境
runs-on: ubuntu-latest
# 任务的步骤
# 任务的步骤
steps:
# 1. 声明 checkout 仓库代码到工作区
# 1. 声明 checkout 仓库代码到工作区
- name: Checkout Git Repo
uses: actions/checkout@v2
# 2. 安装Java 环境 这里会用到的参数就是 Git Action secrets中配置的,
# 取值要在key前面加 secrets.
uses: actions/checkout@v3
# 2. 安装Java 环境 这里会用到的参数就是 Git Action secrets中配置的,
# 取值要在key前面加 secrets.
- name: Set up Maven Central Repo
uses: actions/setup-java@v3
with:
java-version: 17
server-id: sonatype-nexus-staging
server-username: ${{ secrets.OSSRH_USER }}
server-password: ${{ secrets.OSSRH_PASSWORD }}
gpg-passphrase: ${{ secrets.GPG_PASSWORD }}
# 3. 发布到Maven中央仓库
distribution: 'temurin'
cache: maven
# 3. 发布到Maven中央仓库
- name: Publish to Maven Central Repo
# 这里用到了其他人写的action脚本,详细可以去看他的文档。
# 这里用到了其他人写的action脚本,详细可以去看他的文档。
uses: samuelmeuli/action-maven-publish@v1
with:
gpg_private_key: ${{ secrets.GPG_SECRET }}
gpg_passphrase: ${{ secrets.GPG_PASSWORD }}
nexus_username: ${{ secrets.OSSRH_USER }}
nexus_password: ${{ secrets.OSSRH_PASSWORD }}
server_id: ossrh
maven_goals_phases: clean deploy -DskipTests -Prelease
18 changes: 0 additions & 18 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.wang-xiaowu</groupId>
<artifactId>behappy-canal</artifactId>
<version>3.0.0.RELEASE</version>
<version>3.0.0</version>
<name>behappy-canal</name>
<description>canal-数据同步</description>
<packaging>pom</packaging>
Expand Down

0 comments on commit 60e75b1

Please sign in to comment.