提交 ea70c5fc 编写于 作者: 飞机飞过天空's avatar 飞机飞过天空

ci: 快照版本切换,使用 python 脚本替换 maven 插件

上级 9ced5253
name: Deploy snapshot for dev branch
name: Deploy
on:
push:
......@@ -47,11 +47,17 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: get current project version to set env.VERSION
run: echo "VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`" >> $GITHUB_ENV
- name: set snapshot version
if: ${{ !endsWith( env.VERSION , '-SNAPSHOT') }}
run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT
- name: setting snapshot version
run: |
import xml.etree.ElementTree as ET
tree = ET.parse("pom.xml")
version = tree.find("{http://maven.apache.org/POM/4.0.0}version")
print(version.text + "-SNAPSHOT")
if version.text.endswith("-SNAPSHOT") == False:
tree.find("{http://maven.apache.org/POM/4.0.0}version").text = version.text + "-SNAPSHOT"
ET.register_namespace("", "http://maven.apache.org/POM/4.0.0")
tree.write("pom.xml", "utf-8", True)
shell: python
- name: deploy snapshot to ossrh repository
run: mvn -B deploy -P snapshot -DskipTests
env:
......
......@@ -2,7 +2,6 @@ name: test pull_request
on:
pull_request:
branches: [ dev ]
paths:
- src/**
- pom.xml
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册