main.yml 2.4 KB

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