Update initialize-a-github-repo.md (#749) #608
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: Ebook | |
on: | |
push: | |
branches: [ master ] | |
tags: [ v* ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get git tag | |
id: get_ref | |
run: echo ::set-output name=REF::${GITHUB_REF/refs\/tags\//} | |
- name: Assign book version | |
id: get_book_version | |
run: echo ::set-output name=BOOK_VERSION::${{ steps.get_ref.outputs.REF }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- uses: actions/checkout@v2 | |
- run: sudo apt-get update | |
- run: sudo apt-get install -y wget texlive-xetex texlive-fonts-extra | |
- run: sudo wget https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-linux-amd64.tar.gz | |
- run: sudo tar xvzf pandoc-2.10.1-linux-amd64.tar.gz --strip-components 1 -C /usr | |
- run: sudo mkdir -p ~/.fonts | |
- run: sudo cp etc/ebook/fonts/SourceSansPro/*.ttf ~/.fonts | |
- run: sudo cp etc/ebook/fonts/RobotoSlab/*.ttf ~/.fonts | |
- run: sudo cp etc/ebook/fonts/SourceCodePro/*.ttf ~/.fonts | |
- run: cd etc/ebook && make prepare | |
# Merge PDF | |
- run: cd etc/ebook && make merge-pdf | |
env: | |
BOOK_VERSION: ${{ steps.get_book_version.outputs.BOOK_VERSION }} | |
- name: Archive pdf md | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pdf.md | |
path: etc/ebook/output/pdf.md | |
# Merge EPUB | |
- run: cd etc/ebook && make merge-epub | |
env: | |
BOOK_VERSION: ${{ steps.get_book_version.outputs.BOOK_VERSION }} | |
- name: Archive epub md | |
uses: actions/upload-artifact@v2 | |
with: | |
name: epub.md | |
path: etc/ebook/output/epub.md | |
# Generate PDF | |
- run: cd etc/ebook && make build-pdf | |
env: | |
BOOK_VERSION: ${{ steps.get_book_version.outputs.BOOK_VERSION }} | |
- name: Archive pdf | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ebook.pdf | |
path: etc/ebook/output/ebook.pdf | |
# Generate EPUB | |
- run: cd etc/ebook && make build-epub | |
env: | |
BOOK_VERSION: ${{ steps.get_book_version.outputs.BOOK_VERSION }} | |
- name: Archive epub | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ebook.epub | |
path: etc/ebook/output/ebook.epub | |
# Upload PDF | |
- name: Upload book to S3 | |
run: sudo apt-get install -y awscli && aws s3 cp etc/ebook/output/ebook.pdf s3://anomaly/SST/guide/ebook-${{ steps.get_book_version.outputs.BOOK_VERSION }}.pdf --acl public-read --content-disposition 'attachment; filename="sst-guide-${{ steps.get_book_version.outputs.BOOK_VERSION }}.pdf"' | |
if: ${{ startsWith(steps.get_ref.outputs.REF, 'v' ) }} | |
# Upload EPUB | |
- name: Upload book to S3 | |
run: sudo apt-get install -y awscli && aws s3 cp etc/ebook/output/ebook.epub s3://anomaly/SST/guide/ebook-${{ steps.get_book_version.outputs.BOOK_VERSION }}.epub --acl public-read --content-disposition 'attachment; filename="sst-guide-${{ steps.get_book_version.outputs.BOOK_VERSION }}.epub"' | |
if: ${{ startsWith(steps.get_ref.outputs.REF, 'v' ) }} |