release.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. name: Release Version
  3. on:
  4. push:
  5. branches:
  6. - master
  7. jobs:
  8. release:
  9. name: Release Version
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v2
  13. - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
  14. # Cache
  15. - uses: actions/cache@v1
  16. with:
  17. path: ~/.cache/pip
  18. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  19. restore-keys: |
  20. ${{ runner.os }}-pip-
  21. # Setup
  22. - name: Set up Python 3.9
  23. uses: actions/setup-python@v1
  24. with:
  25. python-version: 3.9
  26. - name: Install virtualenv
  27. run: pip install virtualenv
  28. - name: Install dependencies
  29. run: make setup-predeploy
  30. # Release if required
  31. - name: Setup versions in env variables
  32. id: version
  33. run: |
  34. function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
  35. echo "THIS_VERSION=$(make version | sed s/^v//)" >> $GITHUB_ENV
  36. echo "THIS_VERSION_COMPARABLE=$(version $(make version | sed s/^v//))" >> $GITHUB_ENV
  37. echo "LATEST_VERSION_COMPARABLE=$(version $(git describe --tags $(git rev-list --tags --max-count=1) | sed s/^v// 2> /dev/null || echo '0'))" >> $GITHUB_ENV
  38. - name: Create Release
  39. id: create_release
  40. uses: actions/create-release@latest
  41. if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE
  42. env:
  43. GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
  44. with:
  45. tag_name: v${{ env.THIS_VERSION }}
  46. release_name: Release v${{ env.THIS_VERSION }}
  47. body: |
  48. See the CHANGELOG for a list of features included in this release
  49. draft: false
  50. prerelease: true