From 775c060519316724c3d6518191180626df330572 Mon Sep 17 00:00:00 2001
From: sqzw-x <mdcx.feedback@gmail.com>
Date: Sun, 14 Jan 2024 15:31:52 +0800
Subject: [PATCH] CI: build for tags

---
 .github/workflows/release.yml | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 821eecc..8448128 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,6 +3,10 @@ name: Build and Release
 on:
   release:
     types: [ published ]
+  push:
+    tags:
+      - 120*
+      - pre-20*
 
 env:
   PYTHON_VERSION: '3.9'
@@ -112,14 +116,14 @@ jobs:
         uses: svenstaro/upload-release-action@2.7.0
         if: ${{ matrix.build == 'macos' }}
         with:
-          asset_name: MDCx-${{ matrix.build }}-${{ matrix.arch }}.app.zip
+          asset_name: MDCx-$tag-${{ matrix.build }}-${{ matrix.arch }}.app.zip
           file: MDCx.app.zip
-          prerelease: true
+          prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-') }}
 
       - name: Create Release - Windows
         uses: svenstaro/upload-release-action@2.7.0
         if: ${{ matrix.build == 'windows' }}
         with:
-          asset_name: MDCx-${{ matrix.build }}-${{ matrix.arch }}.exe
+          asset_name: MDCx-$tag-${{ matrix.build }}-${{ matrix.arch }}.exe
           file: dist/MDCx.exe
-          prerelease: true
+          prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-') }}