-
-
Notifications
You must be signed in to change notification settings - Fork 6
128 lines (103 loc) · 8.4 KB
/
build-and-deploy.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Build and Deploy
on:
push:
branches:
- master
- release
- embed
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: yarn install --frozen-lockfile --network-timeout 1000000000
# Not yet
# - name: Upload translations to Crowdin
# if: github.ref == 'refs/heads/release'
# # Push any new code-based strings to Crowdin
# run: crowdin-dangerous-upload
# env:
# bloomCrowdinApiToken: ${{ secrets.BLOOM_CROWDIN_TOKEN }}
- name: Download translations from Crowdin
run: yarn crowdin-download
env:
bloomCrowdinApiToken: ${{ secrets.BLOOM_CROWDIN_TOKEN }}
- name: Build
run: |
if [ "${{ github.ref }}" == "refs/heads/master" ]; then
yarn build:ci:alpha
else
yarn build:ci
fi
- name: Run tests
run: yarn test:ci
- name: Deploy to S3 - alpha.bloomlibrary.org
if: github.ref == 'refs/heads/master'
run: |
aws s3 rm s3://alpha.bloomlibrary.org --recursive
# Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself.
# These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced.
aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm"
# Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's
aws s3 cp build s3://alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm"
# make this version of the script that helps with managing history on embedded sites
# note that we do not have the cache-defeating hash on this
aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/alpha-assets/embed-bloomlibrary.js --cache-control no-cache
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }}
- name: Deploy to S3 - dev-alpha.bloomlibrary.org
if: github.ref == 'refs/heads/master'
run: |
aws s3 rm s3://dev-alpha.bloomlibrary.org --recursive
# Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself.
# These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced.
aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm"
# Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's
aws s3 cp build s3://dev-alpha.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }}
- name: Deploy to S3 - bloomlibrary.org
if: github.ref == 'refs/heads/release'
run: |
aws s3 rm s3://bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive
# Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself.
# These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced.
# Please keep the --exclude robots.txt at the end of both commands! If published, it will prevent search engines from indexing us.
aws s3 cp build s3://bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm" --exclude "robots.txt"
# Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's
aws s3 cp build s3://bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm" --exclude "robots.txt"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SIL_BLOOM_UPLOADER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_BLOOM_UPLOADER_AWS_SECRET_ACCESS_KEY }}
- name: Deploy to S3 - dev.bloomlibrary.org
if: github.ref == 'refs/heads/release'
run: |
aws s3 rm s3://dev.bloomlibrary.org --exclude "*/*" --include "bloom-player/*" --include "static/*" --include "translations/*" --recursive
# Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself.
# These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced.
aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm"
# Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's
aws s3 cp build s3://dev.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }}
- name: Deploy to S3 - embed.bloomlibrary.org
if: github.ref == 'refs/heads/embed'
run: |
aws s3 rm s3://embed.bloomlibrary.org --recursive
# Copy everything that should be cached for a long time: contents of static directory and bloom-player directory, except bloom-player.htm itself.
# These things are safe to cache because the build inserts a hash into their names. Any update will cause a different file to be referenced.
aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control max-age=31536000 --exclude "*" --include "static/*" --include "bloom-player/*" --exclude "*.htm"
# Copy everything else, which should not be cached: the root directory files, including index.html, and any htm files, especially bloom-player's
aws s3 cp build s3://embed.bloomlibrary.org --recursive --cache-control no-cache --exclude "static/*" --exclude "bloom-player/*" --include "*.htm"
# make this version of the script that helps with managing history on embedded sites
# note that we do not have the cache-defeating hash on this
aws s3 cp public/embed-bloomlibrary.js s3://share.bloomlibrary.org/assets/embed-bloomlibrary.js --cache-control no-cache
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL_LEAD_BLOOM_LIBRARY_DEPLOY_AWS_SECRET_ACCESS_KEY }}