Luu 1 год назад
Родитель
Сommit
a275a5f291
1 измененных файлов с 32 добавлено и 23 удалено
  1. 32 23
      .github/workflows/build&push.yml

+ 32 - 23
.github/workflows/build&push.yml

@@ -1,37 +1,46 @@
-name: Upload FAP
+name: Build and Upload FAP to Release
 
 
 on:
 on:
-  workflow_dispatch:
+  workflow_dispatch: 
+
+permissions:
+  contents: write 
 
 
 jobs:
 jobs:
   build-and-upload:
   build-and-upload:
+    name: Build and Upload FAP
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+
     steps:
     steps:
-      - name: Checkout code
+      - name: Checkout Repository
         uses: actions/checkout@v3
         uses: actions/checkout@v3
 
 
-      - name: Set up dependencies
+      - name: Extract Version from Manifest
+        id: extract_version
+        run: |
+          VERSION=$(grep '^version:' manifest.yml | awk '{print $2}')
+          echo "VERSION=${VERSION}" >> $GITHUB_ENV
+
+      - name: Set up Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.x'
+
+      - name: Install UFBT
         run: |
         run: |
-          sudo apt-get install gh
-          echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
+          python3 -m pip install --upgrade pip
+          pip install ufbt
 
 
-      - name: Build FAP
+      - name: Initialize UFBT Environment
         run: |
         run: |
-          # Build command here
-          echo "Build completed"
+          ufbt update
+          ufbt vscode_dist
 
 
-      - name: Delete existing asset if it exists
+      - name: Build FAP Applications
+        run: ufbt faps
+
+      - name: Upload Build Outputs to Release
         run: |
         run: |
-          ASSET_ID=$(gh api repos/luu176/Metroflip/releases/192702667/assets | jq '.[] | select(.name=="metroflip.fap") | .id')
-          if [ -n "$ASSET_ID" ]; then
-            echo "Deleting existing asset with ID $ASSET_ID"
-            gh api --method DELETE repos/luu176/Metroflip/releases/assets/$ASSET_ID
-          fi
-
-      - name: Upload FAP
-        uses: actions/upload-release-asset@v1
-        with:
-          upload_url: https://uploads.github.com/repos/luu176/Metroflip/releases/192702667/assets
-          asset_path: /home/runner/.ufbt/build/metroflip.fap
-          asset_name: metroflip.fap
-          asset_content_type: application/octet-stream
+          gh release upload ${{ env.VERSION }} /home/runner/.ufbt/build/metroflip.fap
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}