diff --git a/.github/workflows/buildlatex.yml b/.github/workflows/buildlatex.yml index 6768722..5ca9404 100644 --- a/.github/workflows/buildlatex.yml +++ b/.github/workflows/buildlatex.yml @@ -1,11 +1,18 @@ name: Build LaTeX document -on: [push] +on: + push: + tags: + - 'v*' # Run only on version tags + jobs: build_latex: runs-on: ubuntu-latest + permissions: + contents: write # Needed for creating releases steps: - name: Set up Git repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 + - name: Compile LaTeX document uses: dante-ev/latex-action@latest with: @@ -13,14 +20,15 @@ jobs: working_directory: book args: -pdf -latexoption=-file-line-error -latexoption=-interaction=nonstopmode -latexoption=-shell-escape extra_system_packages: python-pygments - - name: Uploads the document - uses: actions/upload-artifact@v2 + + - name: Get version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v1 with: - name: DynamicalBook - path: book/DynamicalBook.pdf - - run: mkdir build - - run: cp book/DynamicalBook.pdf build/ - - uses: maxheld83/ghpages@v0.3.0 - env: - BUILD_DIR: build/ - GH_PAT: ${{ secrets.GH_PAT }} + name: Release ${{ steps.get_version.outputs.VERSION }} + files: book/DynamicalBook.pdf + draft: false + prerelease: false