main.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. upload-fap:
  38. name: Upload FAP to Existing Release
  39. needs: build
  40. if: github.event_name == 'push' && github.ref == 'refs/heads/main'
  41. runs-on: ubuntu-latest
  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: Upload FAP to Release
  51. uses: actions/upload-release-asset@v1
  52. with:
  53. upload_url: ${{ secrets.GITHUB_RELEASE_UPLOAD_URL }}
  54. asset_path: build/fap/metroflip-${{ env.VERSION }}.fap
  55. asset_name: metroflip-${{ env.VERSION }}.fap
  56. asset_content_type: application/octet-stream