From be789bef91d559c2dfa6318728b86c5a7f7b75a9 Mon Sep 17 00:00:00 2001 From: Sorawit Suriyakarn Date: Tue, 9 Jul 2024 12:51:09 +0700 Subject: [PATCH] Update workflow --- .github/workflows/pandoc.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pandoc.yml b/.github/workflows/pandoc.yml index 74f37d0..ef87d9e 100644 --- a/.github/workflows/pandoc.yml +++ b/.github/workflows/pandoc.yml @@ -1,4 +1,4 @@ -name: Build PDF +name: Build and Deploy PDF on: push: @@ -8,6 +8,11 @@ on: branches: - master +permissions: + contents: read + pages: write + id-token: write + jobs: build: runs-on: ubuntu-latest @@ -22,14 +27,16 @@ jobs: - name: Generate PDF with Pandoc run: docker run --rm --volume "${{ github.workspace }}:/data" --user `id -u`:`id -g` custom-pandoc-latex doc.md -o doc.pdf --template=/data/template.tex - - name: Deploy PDF to GitHub Pages - if: success() - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git clone --depth 1 --branch gh-pages https://github.com/${{ github.repository }} gh-pages - cd gh-pages - cp ../doc.pdf ./whitepaper.pdf - git add whitepaper.pdf - git commit -m 'Update whitepaper' - git push origin gh-pages + - name: Upload artifact to be deployed to GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: doc.pdf + + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }}name