create-new-release.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. push_options: '--force'
  34. build:
  35. runs-on: ubuntu-latest
  36. needs: set-new-version
  37. env:
  38. FBT_NO_SYNC: "true"
  39. TARGETS: f7
  40. DEFAULT_TARGET: f7
  41. steps:
  42. - name: 'Decontaminate previous build leftovers'
  43. run: |
  44. if [ -d .git ]; then
  45. git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
  46. fi
  47. - uses: actions/checkout@v3
  48. with:
  49. ref: "${{needs.set-new-version.outputs.commit_hash}}"
  50. fetch-depth: 0
  51. submodules: 'recursive'
  52. - name: Build
  53. run: ./build.ps1
  54. shell: pwsh
  55. - uses: ncipollo/release-action@v1.12.0
  56. with:
  57. artifacts: "build/*.fap,build/checksums.sha256"
  58. bodyFile: ".github/release-body.md"
  59. artifactErrorsFailBuild: true
  60. updateOnlyUnreleased: true
  61. allowUpdates: true
  62. removeArtifacts: true
  63. draft: true
  64. tag: "v${{ inputs.new_version }}"
  65. commit: "${{needs.set-new-version.outputs.commit_hash}}"