From 8975a52ef0043444e9a244c27076402e070c4abd Mon Sep 17 00:00:00 2001
From: Lin Yinfeng <lin.yinfeng@outlook.com>
Date: Fri, 10 Sep 2021 22:32:17 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=20actions=20=E4=B8=AD?=
 =?UTF-8?q?=E4=BD=BF=E7=94=A8=20artifact=20=E5=88=9B=E5=BB=BA=20release?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .github/workflows/build.yml   | 21 +++++++++++++++++----
 .github/workflows/release.yml | 32 --------------------------------
 2 files changed, 17 insertions(+), 36 deletions(-)
 delete mode 100644 .github/workflows/release.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cb85783..119f09f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,10 +1,6 @@
 name: Build LaTeX document
 on: 
   push:
-    branches:
-      - master
-    tags:
-      - "!v*"
   pull_request:
 
 jobs:
@@ -29,3 +25,20 @@ jobs:
         with:
           name: PDF_${{ matrix.latex }}
           path: njuthesis.pdf
+
+  release:
+    needs: build_latex
+    runs-on: ubuntu-latest
+    if: startsWith(github.ref, 'refs/tags/v')
+    steps:
+      - name: Download artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: PDF_xelatex
+
+      - uses: "marvinpinto/action-automatic-releases@latest"
+        with:
+          repo_token: "${{ secrets.GITHUB_TOKEN }}"
+          prerelease: false
+          files: |
+            njuthesis.pdf
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 48b0f2e..0000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: "tagged-release"
-
-on:
-  push:
-    tags:
-      - "v*"
-
-jobs:
-  tagged-release:
-    name: "Tagged Release"
-    runs-on: "ubuntu-latest"
-    strategy:
-      matrix:
-        latex: [xelatex]
-    steps:
-      - name: Set up Git repository
-        uses: actions/checkout@v2
-
-      - name: Compile to PDF
-        uses: HermitSun/latex-action@v3
-        with:
-          root_file: njuthesis.tex
-          latexmk_use_${{ matrix.latex }}: true
-          args: '-bibtex'
-
-      - uses: "marvinpinto/action-automatic-releases@latest"
-        with:
-          repo_token: "${{ secrets.GITHUB_TOKEN }}"
-          prerelease: false
-          files: |
-            njuthesis.pdf
-- 
GitLab