add release actions (#133)

This commit is contained in:
dxfeng10
2021-04-20 16:00:08 +08:00
committed by GitHub
parent ec1a6a49c6
commit 9c78faf876
4 changed files with 41 additions and 5 deletions

View File

@@ -1,11 +1,14 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
#
name: Java CI with Maven
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
paths-ignore:
@@ -18,10 +21,42 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Maven Repos
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
run: mvn -B clean package --file pom.xml
- uses: bhowell2/github-substring-action@v1.0.0
if: startsWith(github.ref, 'refs/tags/')
id: releaseVersion
with:
fail_if_not_found: false
default_return_value: ${{ github.ref }}
value: ${{ github.ref }}
index_of_str: "v"
- name: Packing
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir fizz-gateway-community
cp ./fizz-bootstrap/target/fizz-bootstrap-*.jar ./fizz-gateway-community/fizz-gateway-community.jar
cp ./fizz-bootstrap/target/classes/application.yml ./fizz-gateway-community/application.yml
cp ./fizz-bootstrap/target/classes/log4j2-spring.xml ./fizz-gateway-community/log4j2-spring.xml
cp ./fizz-bootstrap/sh/boot.sh ./fizz-gateway-community/boot.sh
zip -r ./fizz-gateway-community-${{ steps.releaseVersion.outputs.substring }}.zip ./fizz-gateway-community/*
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: ./fizz-gateway-community-${{ steps.releaseVersion.outputs.substring }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -40,8 +40,9 @@ cd `dirname $0`
#变量定义
APOLLO_META_SERVER=http://localhost:66
ENV=dev
APP_NAME=fizz-gateway-community-1.3.0.jar
#支持 prod/pre/test/dev 4个环境
ENV=prod
APP_NAME=fizz-gateway-community.jar
APP_DEP_DIR="` pwd`"
APP_LOG_DIR=${APP_DEP_DIR}'/logs'
JAVA_CMD=${JAVA_HOME}'/bin/java'
@@ -55,6 +56,7 @@ SERVER_IP="` ip a |egrep "brd" |grep inet|awk '{print $2}'|sed 's#/24##g'|head -
#创建日志目录
mkdir -p ${APP_LOG_DIR}
chmod 755 ${APP_LOG_DIR}
#进入应用所在目录(虽然都是绝对路径,但有些应用需要进入应用目录才能启动成功)
cd ${APP_DEP_DIR}
@@ -104,8 +106,7 @@ start() {
else
echo "starting $APP_NAME ..."
rm -f ${PID_FILE}
#rm -rf ${APP_LOG_DIR}/flumeES/*
${JAVA_CMD} -jar ${JAVA_OPTS} -Denv=$ENV -Dapollo.meta=${APOLLO_META_SERVER} ${APP_DEP_DIR}/${APP_NAME} > ${APP_LOG_DIR}/${APP_NAME}.log 2>&1 &
${JAVA_CMD} -jar ${JAVA_OPTS} -Denv=$ENV -Dspring.profiles.active=$ENV -Dapollo.meta=${APOLLO_META_SERVER} ${APP_DEP_DIR}/${APP_NAME} > ${APP_LOG_DIR}/${APP_NAME}.log 2>&1 &
echo $! > ${PID_FILE}
fi
}