create-new-release.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: Create new release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. new_version:
  6. description: 'New version'
  7. required: true
  8. type: string
  9. jobs:
  10. set-new-version:
  11. runs-on: ubuntu-latest
  12. outputs:
  13. commit_hash: ${{steps.commit_new_version.outputs.commit_hash}}
  14. steps:
  15. - uses: actions/checkout@v3
  16. - name: Set new version format
  17. run: |
  18. if [[ "${{ inputs.new_version }}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]];
  19. then
  20. echo "New version looks okay";
  21. MAJOR="${BASH_REMATCH[1]}"
  22. MINOR="${BASH_REMATCH[2]}"
  23. PATCH="${BASH_REMATCH[3]}"
  24. sed -r -i "s/TOTP_APP_VERSION_MAJOR\\s+\\([0-9]+\\)/TOTP_APP_VERSION_MAJOR ($MAJOR)/g" totp/version.h
  25. sed -r -i "s/TOTP_APP_VERSION_MINOR\\s+\\([0-9]+\\)/TOTP_APP_VERSION_MINOR ($MINOR)/g" totp/version.h
  26. sed -r -i "s/TOTP_APP_VERSION_PATCH\\s+\\([0-9]+\\)/TOTP_APP_VERSION_PATCH ($PATCH)/g" totp/version.h
  27. sed -r -i "s/fap_version=\"[0-9]+\\.[0-9]+\"/fap_version=\"$MAJOR.$MINOR$PATCH\"/g" totp/application.fam
  28. else
  29. echo "Invalid version format";
  30. exit 1
  31. fi
  32. - id: commit_new_version
  33. uses: stefanzweifel/git-auto-commit-action@v4.16.0
  34. with:
  35. commit_message: Updated version
  36. push_options: '--force'
  37. build:
  38. runs-on: ubuntu-latest
  39. needs: set-new-version
  40. env:
  41. FBT_NO_SYNC: "true"
  42. TARGETS: f7
  43. DEFAULT_TARGET: f7
  44. steps:
  45. - uses: actions/checkout@v3
  46. with:
  47. ref: "${{needs.set-new-version.outputs.commit_hash}}"
  48. fetch-depth: 0
  49. submodules: 'recursive'
  50. - name: Install Python
  51. uses: actions/setup-python@v4
  52. with:
  53. python-version: '3.10'
  54. - name: Install uFBT
  55. run: python3 -m pip install --upgrade ufbt
  56. - name: Build
  57. run: ./build.ps1
  58. shell: pwsh
  59. - uses: ncipollo/release-action@v1.12.0
  60. with:
  61. artifacts: "build/*.zip,build/checksums.sha256"
  62. bodyFile: ".github/release-body.md"
  63. artifactErrorsFailBuild: true
  64. updateOnlyUnreleased: true
  65. allowUpdates: true
  66. removeArtifacts: true
  67. draft: true
  68. tag: "v${{ inputs.new_version }}"
  69. commit: "${{needs.set-new-version.outputs.commit_hash}}"