Преглед на файлове

Check POM version and linux metainfo.xml file during release steps

Julian Raufelder преди 2 години
родител
ревизия
ae6a15b391
променени са 1 файла, в които са добавени 39 реда и са изтрити 0 реда
  1. 39 0
      .github/workflows/release-check-precondition.yml

+ 39 - 0
.github/workflows/release-check-precondition.yml

@@ -0,0 +1,39 @@
+name: Release check precondition
+
+on:
+  push:
+    branches:
+      - 'hotfix/**'
+      - 'release/**'
+    tags:
+      - '*'
+
+jobs:
+  test:
+    name: Validate pushed commit to release/hotfix or pushed tag
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - name: Validate POM version
+        run: |
+          if [[ $GITHUB_REF =~ refs/heads/(hotfix|release)/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
+            SEM_VER_STR=${GITHUB_REF##*/}
+          elif [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
+            SEM_VER_STR=${GITHUB_REF##*/}
+          else
+            echo "Failed to parse version"
+            exit 1
+          fi
+
+          if ![[ SEM_VER_STR = `mvn help:evaluate -Dexpression=project.version -q -DforceStdout` ]]; then
+            echo "Version not set in POM"
+            exit 1
+          fi
+      - name: Validate release in org.cryptomator.Cryptomator.metainfo.xml file
+        run: |
+          if ![[ grep "<release date=\".*\" version=\"${SEM_VER_STR}\"/>" dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml ]]; then
+            echo "Release not set in dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml"
+            exit 1
+          fi