docs: enhance contributing guidelines and documentation with notes, t… #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" # This workflow will run when any tag starting with 'v' is pushed | |
| # Add permissions configuration | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| container: | |
| image: registry.gitlab.com/islandoftex/images/texlive:latest | |
| steps: | |
| # Configure Git to trust the workspace directory | |
| - name: Configure Git | |
| run: | | |
| git config --global --add safe.directory "/__w/typesetting/typesetting" | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # We need full history to get commit messages | |
| - name: Get previous tag | |
| id: previoustag | |
| run: | | |
| echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo '')" >> $GITHUB_ENV | |
| echo "CURRENT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Generate release notes | |
| id: generate_notes | |
| shell: sh -e {0} | |
| run: | | |
| if [ -n "$PREVIOUS_TAG" ]; then | |
| echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
| echo "## Changes since $PREVIOUS_TAG" >> $GITHUB_ENV | |
| echo "" >> $GITHUB_ENV | |
| git log --pretty=format:"* %s (%an) [%h](https://github.com/jiahaoxiang2000/typesetting/commit/%H)" $PREVIOUS_TAG..$CURRENT_TAG >> $GITHUB_ENV | |
| echo "" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
| echo "## Initial Release" >> $GITHUB_ENV | |
| echo "" >> $GITHUB_ENV | |
| git log --pretty=format:"* %s (%an) [%h](https://github.com/jiahaoxiang2000/typesetting/commit/%H)" >> $GITHUB_ENV | |
| echo "" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| fi | |
| - name: Compile Chinese documents | |
| run: | | |
| cd zh | |
| mkdir -p build | |
| find . -name "*.tex" -type f -not -path "./build/*" | while read file; do | |
| filename=$(basename "$file" .tex) | |
| echo "Compiling $filename.tex" | |
| latexmk -xelatex -synctex=1 -interaction=nonstopmode -file-line-error -shell-escape "$file" | |
| if [ -f "$filename.pdf" ]; then | |
| mv "$filename.pdf" "build/${filename}.pdf" | |
| fi | |
| done | |
| cd .. | |
| - name: Compile English documents | |
| run: | | |
| cd en | |
| mkdir -p build | |
| find . -name "*.tex" -type f -not -path "./build/*" | while read file; do | |
| filename=$(basename "$file" .tex) | |
| echo "Compiling $filename.tex" | |
| latexmk -pdf -synctex=1 -interaction=nonstopmode -file-line-error "$file" | |
| if [ -f "$filename.pdf" ]; then | |
| mv "$filename.pdf" "build/${filename}.pdf" | |
| fi | |
| done | |
| cd .. | |
| - name: List generated PDFs | |
| run: | | |
| echo "Generated PDFs in zh/build:" | |
| ls -la zh/build || echo "No PDFs found in zh/build" | |
| echo "Generated PDFs in en/build:" | |
| ls -la en/build || echo "No PDFs found in en/build" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Release ${{ env.CURRENT_TAG }} | |
| body: ${{ env.RELEASE_NOTES }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| zh/build/*.pdf | |
| en/build/*.pdf | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |