From 34d6e8c4198ec54522c5c0e9241c104ddb1545c5 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Mon, 10 Oct 2022 15:28:16 +0200 Subject: [PATCH] Validate POM version and linux metainfo.xml file during build --- .github/workflows/build.yml | 23 +++++++++++ .../workflows/release-check-precondition.yml | 39 ------------------- 2 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/release-check-precondition.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5270365b3..83df47560 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,29 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Validate POM version + if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/hotfix/') || startsWith(github.ref, 'refs/heads/release/') + 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 + if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/hotfix/') || startsWith(github.ref, 'refs/heads/release/') + run: | + if ![[ grep "" 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 - name: Sign source tarball with key 615D449FE6E6A235 if: startsWith(github.ref, 'refs/tags/') run: | diff --git a/.github/workflows/release-check-precondition.yml b/.github/workflows/release-check-precondition.yml deleted file mode 100644 index ae598a3f4..000000000 --- a/.github/workflows/release-check-precondition.yml +++ /dev/null @@ -1,39 +0,0 @@ -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 "" 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