book #572
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: book | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 14 * * *' | |
concurrency: | |
group: ${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
ebook: | |
name: Generate and upload book | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Get secrets | |
working-directory: ./backend | |
run: | | |
yarn | |
yarn get-secrets | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Save book content to disk | |
working-directory: ./backend | |
run: | | |
yarn save-book-content-to-disk theauditorbook.md | |
echo "total=$(grep -c '^# ' theauditorbook.md)" >> $GITHUB_ENV | |
- name: Install pandoc, calibre | |
working-directory: ./backend | |
run: | | |
sudo apt-get install pandoc libegl1 libopengl0 | |
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin | |
- name: Generate book | |
working-directory: ./backend | |
run: | | |
yarn generate-from-md-to-epub theauditorbook.md theauditorbook.epub | |
mv theauditorbook.epub .. | |
- name: Convert epub to mobi, pdf | |
run: | | |
ebook-convert theauditorbook.epub theauditorbook.mobi | |
ebook-convert theauditorbook.epub theauditorbook.pdf | |
- name: Upload book to releases | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: v0.${{ env.total }} | |
tag_name: v0.${{ env.total }} | |
files: | | |
theauditorbook.epub | |
theauditorbook.mobi | |
theauditorbook.pdf | |
- name: Update latest release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: latest | |
tag_name: latest | |
files: | | |
theauditorbook.epub | |
theauditorbook.mobi | |
theauditorbook.pdf |