build&push.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Build and Upload FAP
  2. # Allow manual triggering of the workflow
  3. on:
  4. workflow_dispatch:
  5. jobs:
  6. build-and-upload:
  7. name: Build and Upload FAP to Latest Release
  8. runs-on: ubuntu-latest
  9. steps:
  10. # Step 1: Checkout the repository
  11. - name: Checkout Repository
  12. uses: actions/checkout@v3
  13. # Step 2: Set up Python for UFBT
  14. - name: Set up Python
  15. uses: actions/setup-python@v4
  16. with:
  17. python-version: '3.x'
  18. # Step 3: Install UFBT
  19. - name: Install UFBT
  20. run: |
  21. python3 -m pip install --upgrade pip
  22. pip install ufbt
  23. # Step 4: Initialize UFBT Environment
  24. - name: Initialize UFBT Environment
  25. run: |
  26. ufbt update
  27. ufbt vscode_dist
  28. # Step 5: Build the .fap application
  29. - name: Build FAP Application
  30. run: ufbt faps
  31. # Step 6: Get the latest release ID
  32. - name: Get Latest Release
  33. id: latest_release
  34. uses: actions/github-script@v6
  35. with:
  36. script: |
  37. const latestRelease = await github.rest.repos.getLatestRelease({
  38. owner: context.repo.owner,
  39. repo: context.repo.repo,
  40. });
  41. core.setOutput('upload_url', latestRelease.data.upload_url.split('{')[0]);
  42. # Step 7: Upload the .fap file to the latest release
  43. - name: Upload FAP to Latest Release
  44. uses: actions/upload-release-asset@v1
  45. with:
  46. upload_url: ${{ steps.latest_release.outputs.upload_url }}
  47. asset_path: /home/runner/.ufbt/build/metroflip.fap
  48. asset_name: metroflip-${{ env.VERSION || 'latest' }}.fap
  49. asset_content_type: application/octet-stream