diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a83e145..d33528c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,9 @@ name: Release on: - push: - tags: - - "*.*.*" + release: + types: + - published jobs: build: @@ -178,3 +178,42 @@ jobs: git add CHANGELOG.md git commit -m "Update CHANGELOG" git push https://${{ secrets.GITHUB_TOKEN }}@github.com/BITNP/BIThesis.git main + + upload_to_ctan: + name: Upload to CTAN + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + - name: Download bithesis.pdf + uses: actions/download-artifact@v3 + with: + name: bithesis + - run: make pkg-only + - name: Determine version + id: version + run: | + version=${{ github.event.release.tag_name }} + echo "number=$(echo $version | sed 's/^v//')" >> "$GITHUB_OUTPUT" + echo "date=$(date '+%Y-%m-%d')" >> "$GITHUB_OUTPUT" + - name: Determine action + id: action + run: | + echo "action=${{ github.event.release.prerelease && 'validate' || 'upload' }}" >> "$GITHUB_OUTPUT" + - name: Upload to CTAN + uses: paolobrasolin/ctan-submit-action@v1 + with: + action: ${{ steps.action.outputs.action }} + file_path: bithesis.zip + fields: | + update: "true" + pkg: bithesis + version: ${{ steps.version.outputs.number }} ${{ steps.version.outputs.date }} + author: Feng Kaiyu + email: loveress01@outlook.com + uploader: Feng Kaiyu + - name: Report + run: > + echo "🎉 Successfully ${{ steps.action.outputs.action }} + ${{ steps.version.outputs.number }} (${{ steps.version.outputs.date }}) + to [CTAN](https://www.ctan.org/pkg/bithesis)." >> "$GITHUB_STEP_SUMMARY" diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2740197e..ec20a8e6 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -78,7 +78,7 @@ make doc ## 打包 - `make overleaf version=X.X.X` 可以生成上传 overleaf 所需要的 zip 文件。 -- `make pkg` 可以生成上传 CTAN 所需要的 zip 文件。 +- `make pkg` 可以生成上传 CTAN 所需要的 zip 文件。若已有手册而不想重新编译,可 `make pkg-only`。 - `make grad version=X.X.X` 可以生成用作研究生院官网附件的 zip 文件。 ## 上传 Overleaf 与更新 diff --git a/Makefile b/Makefile index cc8b4d34..e8b88c52 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ else endif -.PHONY: all cls doc clean FORCE_MAKE copy +.PHONY: all cls doc clean FORCE_MAKE copy pkg pkg-only $(PACKAGE).pdf: cls FORCE_MAKE @$(LATEXMK) -xelatex $(PACKAGE).dtx @@ -94,13 +94,15 @@ dev: dev-doc: ls bithesis.dtx | entr -s 'make clean-all && yes y | make doc && open bithesis.pdf' -pkg: doc +pkg-only: rm -rf ./bithesis ./bithesis.zip mkdir bithesis - cp bithesis.{ins,dtx,pdf} ./README*.md ./contributing*.md ./bithesis + cp bithesis.ins bithesis.dtx bithesis.pdf ./README*.md ./contributing*.md ./bithesis mv ./bithesis/README-bithesis.md ./bithesis/README.md zip -r bithesis.zip bithesis +pkg: doc pkg-only + GRAD_DEST_DIR = ./BIThesis-graduate-thesis-template grad: doc copy FORCE_MAKE