From ea70c5fc8112fa373298edf8dc8fb7ff4d5fd830 Mon Sep 17 00:00:00 2001 From: kang <1115610574@qq.com> Date: Tue, 24 Aug 2021 22:36:00 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=BF=AB=E7=85=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=88=87=E6=8D=A2=EF=BC=8C=E4=BD=BF=E7=94=A8=20python=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=9B=BF=E6=8D=A2=20maven=20=E6=8F=92?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-snapshot.yml | 18 ++++++++++++------ .github/workflows/test-pr.yml | 1 - 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-snapshot.yml b/.github/workflows/deploy-snapshot.yml index c081b0d..7e5cc72 100644 --- a/.github/workflows/deploy-snapshot.yml +++ b/.github/workflows/deploy-snapshot.yml @@ -1,4 +1,4 @@ -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: diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index b450c1e..ef4204f 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -2,7 +2,6 @@ name: test pull_request on: pull_request: - branches: [ dev ] paths: - src/** - pom.xml -- GitLab