Upload image artifact on on manual workflow run #1652
This file contains 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: Documentation | |
on: | |
push: | |
branches: [ '*' ] | |
pull_request: | |
branches: [ '*' ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
docs: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: { node-version: '10' } | |
- name: Setup tools | |
run: | | |
sudo sh -c "echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections" | |
sudo apt-get update && sudo apt-get install -y calibre msttcorefonts | |
builder/assets/install_gitbook.sh | |
npm install [email protected] -g # FIXME: https://github.com/DavidAnson/markdownlint/issues/435 | |
npm install svgexport -g | |
gitbook -V | |
markdownlint -V | |
- name: Run markdownlint | |
run: markdownlint docs | |
- name: Check Assets | |
run: | | |
./check_assets_size.py | |
./check_unused_assets.py | |
- name: Build GitBook | |
run: | | |
gitbook install | |
gitbook build | |
- name: Generate PDF | |
id: generate-pdf | |
env: | |
GITBOOK_SKIP_PDF: ${{ secrets.GITBOOK_SKIP_PDF }} | |
continue-on-error: ${{ env.GITBOOK_SKIP_PDF != '' }} | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
for i in 1 2 3 4; do gitbook pdf ./ _book/clover.pdf && break || sleep 1; done | |
sudo apt-get -q install ghostscript | |
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile=_book/clover_ru_compressed.pdf _book/clover_ru.pdf | |
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile=_book/clover_en_compressed.pdf _book/clover_en.pdf | |
rm _book/clover_ru.pdf && mv _book/clover_ru_compressed.pdf _book/clover_ru.pdf | |
rm _book/clover_en.pdf && mv _book/clover_en_compressed.pdf _book/clover_en.pdf | |
ls -lah _book/clover*.pdf | |
echo '::set-output name=GITBOOK_PDF_OK::1' | |
- name: Download older PDFs | |
if: ${{ !steps.generate-pdf.outputs.GITBOOK_PDF_OK }} | |
run: | | |
rm -f _book/clover*.pdf | |
wget --no-verbose https://clover.coex.tech/clover_ru.pdf -P _book/ | |
wget --no-verbose https://clover.coex.tech/clover_en.pdf -P _book/ | |
- name: Upload artifact | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: _book | |
deploy-docs: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: docs | |
steps: | |
- name: Deploy to GitHub Pages | |
env: | |
FREEZE_DOCS: ${{ secrets.FREEZE_DOCS }} | |
if: ${{ !env.FREEZE_DOCS }} | |
id: deployment | |
uses: actions/deploy-pages@v1 |