release.yaml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Release
  2. on:
  3. push:
  4. tags: ['v*']
  5. defaults:
  6. run:
  7. shell: bash
  8. jobs:
  9. draft-release:
  10. name: Create draft release
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Check out repository
  14. uses: actions/checkout@v3
  15. with:
  16. fetch-depth: 0
  17. - uses: ./.github/actions/setup
  18. with:
  19. python-version: "3.9"
  20. venv-id: "release"
  21. poetry-dependency-install-flags: "--all-extras"
  22. - name: Add version to environment
  23. run: |
  24. PROJECT_VERSION=$(poetry version --short)
  25. echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
  26. - name: Run tests
  27. run: |
  28. poetry run pytest -r a -v src tests --doctest-modules
  29. - name: Build package
  30. run: |
  31. poetry build --no-interaction
  32. - name: Generate Release Notes
  33. run: |
  34. git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty='format:* %h %s' --no-merges >> ".github/release_template.md"
  35. - name: Create Release Draft
  36. uses: softprops/action-gh-release@v1
  37. with:
  38. body_path: ".github/release_template.md"
  39. token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
  40. draft: true
  41. files: |
  42. dist/unfccc_ghg_data-${{ env.PROJECT_VERSION }}-py3-none-any.whl
  43. dist/unfccc_ghg_data-${{ env.PROJECT_VERSION }}.tar.gz