Pārlūkot izejas kodu

Update main.yml

Luu 1 gadu atpakaļ
vecāks
revīzija
49a2e53762
1 mainītis faili ar 31 papildinājumiem un 4 dzēšanām
  1. 31 4
      .github/workflows/main.yml

+ 31 - 4
.github/workflows/main.yml

@@ -44,12 +44,39 @@ jobs:
           name: build-output
           path: build/
 
-  upload-fap:
-    name: Upload FAP to Existing Release
+  create-release:
+    name: Create GitHub Release
     needs: build
-    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
     runs-on: ubuntu-latest
+    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+    steps:
+      - name: Checkout Repository
+        uses: actions/checkout@v3
+
+      - name: Extract Version from Manifest
+        id: extract_version
+        run: |
+          VERSION=$(grep '^version:' manifest.yml | awk '{print $2}')
+          echo "VERSION=${VERSION}" >> $GITHUB_ENV
 
+      - name: Create Release
+        id: create_release
+        uses: actions/create-release@v1
+        with:
+          tag_name: v${{ env.VERSION }}
+          release_name: Metroflip v${{ env.VERSION }}
+          body: |
+            **What's New:**
+            $(cat CHANGELOG.md)
+          draft: false
+          prerelease: false
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+  upload-fap:
+    name: Upload FAP to Release
+    needs: create-release
+    runs-on: ubuntu-latest
     steps:
       - name: Checkout Repository
         uses: actions/checkout@v3
@@ -63,7 +90,7 @@ jobs:
       - name: Upload FAP to Release
         uses: actions/upload-release-asset@v1
         with:
-          upload_url: ${{ secrets.GITHUB_RELEASE_UPLOAD_URL }}
+          upload_url: ${{ steps.create_release.outputs.upload_url }}
           asset_path: build/fap/metroflip-${{ env.VERSION }}.fap
           asset_name: metroflip-${{ env.VERSION }}.fap
           asset_content_type: application/octet-stream