You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

111 lines
3.9 KiB

  1. name: Release Application
  2. on:
  3. push:
  4. tags: ['v*']
  5. jobs:
  6. release:
  7. name: Create release
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v2
  12. - name: Setup
  13. run: |
  14. sudo apt update
  15. sudo apt install ruby
  16. sudo gem install ronn
  17. - name: Prepare release
  18. id: prepare_release
  19. run: |
  20. changelog="$(git diff HEAD^ HEAD -- CHANGELOG.md | grep -E '\+[#*]' | sed 's/^+//')"
  21. changelog="${changelog//$'%'/'%25'}"
  22. changelog="${changelog//$'\n'/'%0A'}"
  23. changelog="${changelog//$'\r'/'%0D'}"
  24. echo "::set-output name=changelog::$changelog"
  25. - name: Build locales
  26. env:
  27. POEDITOR_API_ACCESS: ${{ secrets.POEDITOR_API_ACCESS }}
  28. run: |
  29. make POEDITOR_API_ACCESS="${POEDITOR_API_ACCESS}" i18n
  30. tar cf locales.tar.gz kosmorrolib/locales
  31. - name: Create release
  32. id: create_release
  33. uses: actions/create-release@v1
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. with:
  37. tag_name: ${{ github.ref }}
  38. release_name: Version ${{ github.ref }}
  39. draft: true
  40. prerelease: false
  41. body: |
  42. ${{ steps.prepare_release.outputs.changelog }}
  43. - name: Upload locales
  44. id: upload-locales
  45. uses: actions/upload-release-asset@v1
  46. env:
  47. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  48. with:
  49. upload_url: ${{ steps.create_release.outputs.upload_url }}
  50. asset_path: ./locales.tar.gz
  51. asset_name: locales.tar.gz
  52. asset_content_type: application/x-tar
  53. pip:
  54. name: Release to PyPI
  55. runs-on: ubuntu-latest
  56. steps:
  57. - uses: actions/checkout@v1
  58. - name: Set up Python
  59. uses: actions/setup-python@v1
  60. with:
  61. python-version: '3.7'
  62. - name: Setup environment
  63. run: |
  64. sudo apt update
  65. sudo apt install ruby
  66. sudo gem install ronn
  67. - name: Install dependencies
  68. run: |
  69. python -m pip install --upgrade pip
  70. pip install setuptools wheel twine skyfield numpy tabulate Babel requests
  71. - name: Build and publish
  72. env:
  73. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  74. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  75. POEDITOR_API_ACCESS: ${{ secrets.POEDITOR_API_ACCESS }}
  76. POEDITOR_PROJECT_ID: 306433
  77. run: |
  78. make POEDITOR_API_ACCESS="${POEDITOR_API_ACCESS}" POEDITOR_PROJECT_ID="306433" build
  79. twine upload dist/*
  80. docker:
  81. name: Push to DockerHub
  82. runs-on: ubuntu-latest
  83. steps:
  84. -
  85. name: Set up QEMU
  86. uses: docker/setup-qemu-action@v1
  87. -
  88. name: Set up Docker Buildx
  89. uses: docker/setup-buildx-action@v1
  90. -
  91. name: Login to DockerHub
  92. uses: docker/login-action@v1
  93. with:
  94. username: ${{ secrets.DOCKERHUB_USERNAME }}
  95. password: ${{ secrets.DOCKERHUB_TOKEN }}
  96. -
  97. name: Build and push
  98. id: docker_build
  99. uses: docker/build-push-action@v2
  100. with:
  101. push: true
  102. file: ./Dockerfile
  103. platforms: linux/amd64,linux/arm64,linux/386
  104. tags: kosmorro/kosmorro:latest
  105. -
  106. name: Image digest
  107. run: echo ${{ steps.docker_build.outputs.digest }}