diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2693deb7b21cb11b5c8eb2d18cf72bb0e15adfe..fd87ded498ca94969037f8dd196dd0bd002c7696 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,9 @@ on: branches: - master + tags: + - v* + pull_request: branches: - master @@ -30,3 +33,38 @@ 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: Set up Git repository + uses: actions/checkout@v2 + + - name: Zip Release Source + run: | + zip -r njuthesis.zip . -x ".git/*" ".github/*" ".gitignore" "*.dtx" + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: PDF_xelatex + + - name: Zip CTAN Source + run: | + mkdir -p njuthesis/ + cp njuthesis.pdf njuthesis/njuthesis.pdf + cp README.md njuthesis/README_ZH_CN.md + cp README_EN.md njuthesis/README.md + cp -r figure/ LICENSE njuthesis.dtx njuthesis/ + zip -r njuthesis_ctan.zip njuthesis/ + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + njuthesis.pdf + njuthesis.zip + njuthesis_ctan.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a835aa6c4d2cdbc86e09745a556d5f686b38e19b..0000000000000000000000000000000000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Release LaTeX document -on: - push: - tags: - - v* - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Set up Git repository - uses: actions/checkout@v2 - - - name: Compile to PDF - uses: HermitSun/latex-action@v3 - with: - root_file: njuthesis.dtx - args: '-bibtex' - - - name: Zip Release Source - run: | - zip -r njuthesis.zip . -x ".git/*" ".github/*" ".gitignore" - - - name: Zip CTAN Source - run: | - mkdir -p njuthesis/ - cp njuthesis.pdf njuthesis/njuthesis.pdf - cp README.md njuthesis/README_ZH_CN.md - cp README_EN.md njuthesis/README.md - cp -r figure/ LICENSE njuthesis.dtx njuthesis/ - zip -r njuthesis_ctan.zip njuthesis/ - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - files: | - njuthesis.pdf - njuthesis.zip - njuthesis_ctan.zip