Răsfoiți Sursa

ci: attach binaries and packages to a draft release on tag push

Add a Release workflow that runs on version tags. It calls the binaries,
Debian and RPM workflows, then creates a draft GitHub release with all
the built files attached, or adds them to an existing draft for the tag.
Frédéric Guillot 19 ore în urmă
părinte
comite
a7205cd95d

+ 1 - 3
.github/workflows/build_binaries.yml

@@ -3,9 +3,7 @@ permissions:
   contents: read
 on:
   workflow_dispatch:
-  push:
-    tags:
-      - '[0-9]+.[0-9]+.[0-9]+'
+  workflow_call:
   pull_request:
     branches: [ main ]
     paths:

+ 8 - 3
.github/workflows/debian_packages.yml

@@ -3,9 +3,7 @@ permissions:
   contents: read
 on:
   workflow_dispatch:
-  push:
-    tags:
-      - '[0-9]+.[0-9]+.[0-9]+'
+  workflow_call:
   schedule:
     - cron: '0 0 * * 1,4' # Runs at 00:00 UTC on Monday and Thursday
   pull_request:
@@ -93,6 +91,13 @@ jobs:
       run: make debian-packages
     - name: List generated files
       run: ls -l *.deb
+    - name: Upload packages for the release
+      uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+      with:
+        name: debian-packages
+        path: "*.deb"
+        if-no-files-found: error
+        retention-days: 5
     - name: Upload packages to repository
       env:
         FURY_TOKEN: ${{ secrets.FURY_TOKEN }}

+ 43 - 0
.github/workflows/release.yml

@@ -0,0 +1,43 @@
+name: Release
+permissions:
+  contents: read
+on:
+  push:
+    tags:
+      - '[0-9]+.[0-9]+.[0-9]+'
+jobs:
+  binaries:
+    name: Binaries
+    uses: ./.github/workflows/build_binaries.yml
+  debian-packages:
+    name: Debian Packages
+    uses: ./.github/workflows/debian_packages.yml
+  rpm-packages:
+    name: RPM Packages
+    uses: ./.github/workflows/rpm_packages.yml
+  draft-release:
+    name: Draft Release
+    if: github.repository_owner == 'miniflux'
+    needs: [binaries, debian-packages, rpm-packages]
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+    steps:
+      - name: Download artifacts
+        uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+        with:
+          path: dist
+          merge-multiple: true
+      - name: List release files
+        run: ls -l dist
+      - name: Create or update draft release
+        env:
+          GH_TOKEN: ${{ github.token }}
+          GH_REPO: ${{ github.repository }}
+          TAG: ${{ github.ref_name }}
+        run: |
+          if [ "$(gh release view "$TAG" --json isDraft --jq .isDraft 2>/dev/null)" = "true" ]; then
+            gh release upload "$TAG" dist/* --clobber
+          else
+            gh release create "$TAG" dist/* --draft --verify-tag --title "Miniflux $TAG" --notes ""
+          fi

+ 8 - 3
.github/workflows/rpm_packages.yml

@@ -3,9 +3,7 @@ permissions:
   contents: read
 on:
   workflow_dispatch:
-  push:
-    tags:
-      - '[0-9]+.[0-9]+.[0-9]+'
+  workflow_call:
   schedule:
     - cron: '0 0 * * 1,4' # Runs at 00:00 UTC on Monday and Thursday
   pull_request:
@@ -60,6 +58,13 @@ jobs:
       run: make rpm
     - name: List generated files
       run: ls -l *.rpm
+    - name: Upload package for the release
+      uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+      with:
+        name: rpm-packages
+        path: "*.rpm"
+        if-no-files-found: error
+        retention-days: 5
     - name: Upload package to repository
       env:
         FURY_TOKEN: ${{ secrets.FURY_TOKEN }}