create-new-release.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. sed -r -i 's/TOTP_APP_VERSION_MAJOR\s+\([0-9]+\)/TOTP_APP_VERSION_MAJOR (${BASH_REMATCH[1]})/g' totp/version.h
  22. sed -r -i 's/TOTP_APP_VERSION_MINOR\s+\([0-9]+\)/TOTP_APP_VERSION_MINOR (${BASH_REMATCH[2]})/g' totp/version.h
  23. sed -r -i 's/TOTP_APP_VERSION_PATCH\s+\([0-9]+\)/TOTP_APP_VERSION_PATCH (${BASH_REMATCH[3]})/g' totp/version.h
  24. sed -r -i 's/fap_version="[0-9]+\.[0-9]+"/fap_version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}${BASH_REMATCH[3]}"/g' totp/application.fam
  25. else
  26. echo "Invalid version format";
  27. exit 1
  28. fi
  29. - id: commit_new_version
  30. uses: stefanzweifel/git-auto-commit-action@v4.16.0
  31. with:
  32. commit_message: Updated version
  33. build:
  34. runs-on: ubuntu-latest
  35. needs: set-new-version
  36. env:
  37. FBT_NO_SYNC: "true"
  38. TARGETS: f7
  39. DEFAULT_TARGET: f7
  40. steps:
  41. - name: 'Decontaminate previous build leftovers'
  42. run: |
  43. if [ -d .git ]; then
  44. git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
  45. fi
  46. - uses: actions/checkout@v3
  47. with:
  48. ref: "${{needs.set-new-version.outputs.commit_hash}}"
  49. fetch-depth: 0
  50. submodules: 'recursive'
  51. - name: Build
  52. run: ./build.ps1
  53. shell: pwsh
  54. - uses: ncipollo/release-action@v1.12.0
  55. with:
  56. artifacts: "build/*.fap,build/checksums.sha256"
  57. bodyFile: ".github/release-body.md"
  58. artifactErrorsFailBuild: true
  59. updateOnlyUnreleased: true
  60. allowUpdates: true
  61. removeArtifacts: true
  62. draft: true
  63. tag: "v${{ inputs.new_version }}"
  64. commit: "${{needs.set-new-version.outputs.commit_hash}}"