main.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. name: UFBT Build and Release
  2. permissions:
  3. contents: write
  4. on:
  5. push:
  6. branches:
  7. - main
  8. pull_request:
  9. branches:
  10. - main
  11. jobs:
  12. build:
  13. name: Build and Test Application
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Checkout Repository
  17. uses: actions/checkout@v3
  18. - name: Set up Python
  19. uses: actions/setup-python@v4
  20. with:
  21. python-version: '3.x'
  22. - name: Install UFBT
  23. run: |
  24. python3 -m pip install --upgrade pip
  25. pip install ufbt
  26. - name: Initialize UFBT Environment
  27. run: |
  28. ufbt update
  29. ufbt vscode_dist
  30. - name: Build FAP Applications
  31. run: ufbt faps
  32. - name: Upload Build Artifacts
  33. uses: actions/upload-artifact@v3
  34. with:
  35. name: build-output
  36. path: build/
  37. create-release:
  38. name: Create GitHub Release
  39. needs: build
  40. runs-on: ubuntu-latest
  41. if: github.event_name == 'push' && github.ref == 'refs/heads/main'
  42. steps:
  43. - name: Checkout Repository
  44. uses: actions/checkout@v3
  45. - name: Extract Version from Manifest
  46. id: extract_version
  47. run: |
  48. VERSION=$(grep '^version:' manifest.yml | awk '{print $2}')
  49. echo "VERSION=${VERSION}" >> $GITHUB_ENV
  50. - name: Create Release
  51. id: create_release
  52. uses: actions/create-release@v1
  53. with:
  54. tag_name: v${{ env.VERSION }}
  55. release_name: Metroflip v${{ env.VERSION }}
  56. body: |
  57. **What's New:**
  58. $(cat CHANGELOG.md)
  59. draft: false
  60. prerelease: false
  61. env:
  62. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  63. upload-fap:
  64. name: Upload FAP to Release
  65. needs: create-release
  66. runs-on: ubuntu-latest
  67. steps:
  68. - name: Checkout Repository
  69. uses: actions/checkout@v3
  70. - name: Extract Version from Manifest
  71. id: extract_version
  72. run: |
  73. VERSION=$(grep '^version:' manifest.yml | awk '{print $2}')
  74. echo "VERSION=${VERSION}" >> $GITHUB_ENV
  75. - name: Upload FAP to Release
  76. uses: actions/upload-release-asset@v1
  77. with:
  78. upload_url: ${{ steps.create_release.outputs.upload_url }}
  79. asset_path: build/fap/metroflip-${{ env.VERSION }}.fap
  80. asset_name: metroflip-${{ env.VERSION }}.fap
  81. asset_content_type: application/octet-stream