Skip to content

Commit

Permalink
actions: add github action to publish Seata to OSSRH (apache#4790)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 authored Jul 21, 2022
1 parent 06dae93 commit 3b607c2
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 27 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
os: [ ubuntu-18.04 ]
Expand All @@ -29,9 +30,9 @@ jobs:
- name: "Set up ENV"
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: if [ "${{ matrix.java }}" == "8" ]; then
echo "IMAGE_NAME=openjdk:8u212-jre-alpine" >> $GITHUB_ENV;
echo "IMAGE_NAME=openjdk:8u212-jre-alpine" >> $GITHUB_ENV;
elif [ "${{ matrix.java }}" == "11" ]; then
echo "IMAGE_NAME=openjdk:11-jre-stretch" >> $GITHUB_ENV;
echo "IMAGE_NAME=openjdk:11-jre-stretch" >> $GITHUB_ENV;
fi

# step 4
Expand All @@ -41,9 +42,9 @@ jobs:
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
# https://docs.github.com/cn/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
run: if [ "${{matrix.java}}" == "8" ] && [ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/develop" ]; then
./mvnw -T 4C clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -P image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
./mvnw -T 4C clean test -e -Pimage -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw -T 4C clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
./mvnw -T 4C clean test -e -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi

# step 5
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/publish-to-ossrh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Publish To OSSRH"

on:
push:
branches: [ develop, 1.*.*, 2.*.* ]
#tags: [ "*" ]

jobs:
publish:
name: "Publish To OSSRH"
runs-on: ubuntu-latest
steps:
# step 1
- name: "Checkout"
uses: actions/[email protected]

# step 2
- name: "Setup Java JDK"
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: 8
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD

# step 3
- name: "Import GPG-SECRET-KEY"
run: |
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import
# step 4
- name: "Package and Publish-To-OSSRH"
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USER }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: ./mvnw -T 4C clean deploy -Prelease,release-by-github-actions -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} --batch-mode -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
36 changes: 19 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 11, 17 ]
springboot: [
2.6.4,
2.5.10,
2.4.13,
2.3.12.RELEASE,
2.2.13.RELEASE,
#2.1.18.RELEASE,
#2.0.9.RELEASE,
#1.5.22.RELEASE,
#1.4.7.RELEASE,
#1.3.8.RELEASE,
#1.2.8.RELEASE,
#1.1.12.RELEASE,
#1.0.2.RELEASE
2.7.1,
2.6.9,
2.5.14,
2.4.13,
2.3.12.RELEASE,
2.2.13.RELEASE,
#2.1.18.RELEASE,
#2.0.9.RELEASE,
#1.5.22.RELEASE,
#1.4.7.RELEASE,
#1.3.8.RELEASE,
#1.2.8.RELEASE,
#1.1.12.RELEASE,
#1.0.2.RELEASE
]
steps:
# step 1
Expand All @@ -41,7 +43,7 @@ jobs:
- name: "Test with Maven"
# https://docs.github.com/cn/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
run: if [ "${{ matrix.java }}" == "8" ]; then
./mvnw -T 4C clean install -e -Dspring-boot.version=${{ matrix.springboot }} -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw -T 4C clean install -e -P args-for-un-java8 -Dspring-boot.version=${{ matrix.springboot }} -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
./mvnw -T 4C clean test -e -Dspring-boot.version=${{ matrix.springboot }} -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw -T 4C clean test -e -Pargs-for-un-java8 -Dspring-boot.version=${{ matrix.springboot }} -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ install: true

before_script:
- if [ "$TRAVIS_JDK_VERSION" == "openjdk8" ]; then
export IMAGE_NAME="openjdk:8u212-jre-alpine";
export IMAGE_NAME="openjdk:8u212-jre-alpine";
fi
- if [ "$TRAVIS_JDK_VERSION" == "openjdk11" ]; then
export IMAGE_NAME="openjdk:11-jre-stretch";
export IMAGE_NAME="openjdk:11-jre-stretch";
fi

script:
- if [ "$TRAVIS_BRANCH" == "develop" ] && [ "$TRAVIS_PULL_REQUEST" == false ]; then
travis_wait 30 ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -P image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
travis_wait 30 ./mvnw clean test -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -P image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
travis_wait 30 ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
travis_wait 30 ./mvnw clean test -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
after_success:
- bash <(curl -s https://codecov.io/bash)
19 changes: 18 additions & 1 deletion build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!-- Maven plugin versions -->
<!-- Build -->
<easyj-maven-plugin.version>0.5.6</easyj-maven-plugin.version>
<easyj-maven-plugin.version>1.0.5</easyj-maven-plugin.version>
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
<!-- Compiler -->
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
Expand Down Expand Up @@ -117,6 +117,8 @@
<maven.test.skip>false</maven.test.skip>
<maven.surefire.argLine></maven.surefire.argLine>
<gpg.keyname>A1C4DAB9B220DBA0C277E945D6A1420D747D1EE0</gpg.keyname>
<gpg.arg1/>
<gpg.arg2/>

<!-- For docker image-->
<image.publish.skip>true</image.publish.skip>
Expand Down Expand Up @@ -183,6 +185,7 @@
</executions>
<configuration>
<simplifiedPomFileName>.flattened-pom.xml</simplifiedPomFileName>
<useTabIndent>true</useTabIndent>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -337,6 +340,10 @@
</goals>
<configuration>
<keyname>${gpg.keyname}</keyname>
<gpgArguments>
<arg>${gpg.arg1}</arg>
<arg>${gpg.arg2}</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
Expand All @@ -356,6 +363,16 @@
</distributionManagement>
</profile>

<!-- profile: release-by-github-actions -->
<profile>
<id>release-by-github-actions</id>
<properties>
<gpg.arg1>--pinentry-mode</gpg.arg1>
<gpg.arg2>loopback</gpg.arg2>
</properties>
</profile>

<!-- profile: args-for-un-java8 -->
<profile>
<id>args-for-un-java8</id>
<properties>
Expand Down
3 changes: 2 additions & 1 deletion changes/en-us/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Add changes here for all PR submitted to the develop branch.


### optimize:
- [[#4774](https://github.com/seata/seata/pull/4774)] optimize mysql8 dependencies for seataio/seata-server image
- [[#4774](https://github.com/seata/seata/pull/4774)] optimize mysql8 dependencies for seataio/seata-server image
- [[#4790](https://github.com/seata/seata/pull/4790)] Add a github action to publish Seata to OSSRH


### test:
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### optimize:
- [[#4774](https://github.com/seata/seata/pull/4774)] 优化 seataio/seata-server 镜像中的 mysql8 依赖
- [[#4790](https://github.com/seata/seata/pull/4790)] 添加一个 github action,用于自动发布Seata到OSSRH


### test:
Expand Down

0 comments on commit 3b607c2

Please sign in to comment.