diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5bdc4ee5..ce5117e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,9 +29,11 @@ jobs: port: ${{ secrets.PORT }} # 服务器ssh端口(默认22) script: | cd /root/Official-website-backend + rm -rf dist git pull bash ./gradlew build -x test cd dist + export DBPWD=${{secrets.SPRING_DATASOURCE_PASSWORD}} bash stop.sh bash start.sh diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c8b1c137..eda9aebe 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,7 @@ spring: #type: com.alibaba.druid.pool.DruidDataSource username: root # password: 12345678 - password: ${SPRING_DATASOURCE_PASSWORD} + password: {{SPRING_DATASOURCE_PASSWORD}} jpa: hibernate: ddl-auto: update diff --git a/start.sh b/start.sh index 0a600df3..69c8a5a2 100644 --- a/start.sh +++ b/start.sh @@ -5,7 +5,7 @@ CLASSPATH='conf/:apps/*:lib/*' CURRENT_DIR=$(pwd)/ LOG_DIR=${CURRENT_DIR}log CONF_DIR=${CURRENT_DIR}conf -#sed "s/\${SPRING_DATASOURCE_PASSWORD}/$DBPWD/g" conf/application.yml > conf/application.yml +cat conf/application.yml | sed "s/{{SPRING_DATASOURCE_PASSWORD}}/$DBPWD/g" conf/application.yml > conf/aa.yml SERVER_PORT=$(cat $CONF_DIR/application.yml | grep "server:" -A 3 | grep "port" | awk '{print $2}'| sed 's/\r//') if [ ${SERVER_PORT}"" = "" ];then echo "$CONF_DIR/application.yml server port has not been configured"