forked from hendricius/the-sourdough-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (97 loc) · 3.26 KB
/
release-book-website.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Release the book and website
on:
push:
branches:
- main
env:
IMAGE: ghcr.io/${{ github.repository }}:latest
jobs:
build-and-push-image:
uses: ./.github/workflows/docker-build-push.yml
release-book-website:
needs: build-and-push-image
runs-on: ubuntu-latest
steps:
- name: Set up git repository
uses: actions/checkout@v3
- name: Print dependency versions
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make show_tools_version
- name: Print build variables
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make printvars
- name: Bake the book
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make -j bake
- name: Release baked book to S3
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.AWS_BUCKET_BOOK }}
source_dir: book/release
destination_dir: release
- name: Upload book Artifacts
uses: actions/upload-artifact@v3
with:
name: books
path: |
book/book_serif/book.log
book/book_serif/book.pdf
book/book-epub/book.epub
- name: Bake the website
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE }}
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make mrproper && make website
- name: Release baked website to S3
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: ${{ secrets.AWS_BUCKET_WEBSITE }}
source_dir: website/static_website_html
destination_dir: static_html_root
- name: Upload website Artifacts
uses: actions/upload-artifact@v3
with:
name: website
path: website/static_website_html
invalidate-book-website-cache:
needs: release-book-website
runs-on: ubuntu-latest
steps:
- name: Invalidate Cloudfront book cache
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_BOOK }}
PATHS: "/*"
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Invalidate Cloudfront website cache
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_WEBSITE }}
PATHS: "/*"
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}