release-check-precondition.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. name: Release check precondition
  2. on:
  3. push:
  4. branches:
  5. - 'hotfix/**'
  6. - 'release/**'
  7. tags:
  8. - '*'
  9. jobs:
  10. test:
  11. name: Validate pushed commit to release/hotfix or pushed tag
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v2
  15. with:
  16. fetch-depth: 0
  17. - name: Validate POM version
  18. run: |
  19. if [[ $GITHUB_REF =~ refs/heads/(hotfix|release)/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
  20. SEM_VER_STR=${GITHUB_REF##*/}
  21. elif [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
  22. SEM_VER_STR=${GITHUB_REF##*/}
  23. else
  24. echo "Failed to parse version"
  25. exit 1
  26. fi
  27. if ![[ SEM_VER_STR = `mvn help:evaluate -Dexpression=project.version -q -DforceStdout` ]]; then
  28. echo "Version not set in POM"
  29. exit 1
  30. fi
  31. - name: Validate release in org.cryptomator.Cryptomator.metainfo.xml file
  32. run: |
  33. if ![[ grep "<release date=\".*\" version=\"${SEM_VER_STR}\"/>" dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml ]]; then
  34. echo "Release not set in dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml"
  35. exit 1
  36. fi