-
-
Notifications
You must be signed in to change notification settings - Fork 444
86 lines (75 loc) · 3.14 KB
/
ebook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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' ) }}