forked from teaxyz/white-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (86 loc) · 2.84 KB
/
make.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
name: make
on:
workflow_call:
inputs:
release:
default: false
required: false
type: boolean
upload:
default: false
required: false
type: boolean
env:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
jobs:
make:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: | # Use on-box make until tea/pantry revlock is resolved
sudo apt-get update
sudo apt-get install \
texlive-latex-base \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive \
texlive-latex-extra \
texlive-xetex
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install \
pandoc \
pandoc-crossref \
librsvg
#FIXME: Can't pass secrets to remote-branch CI, so this is until teaxyz/pantry is public
sed -ne 's/^# tea\/white-paper \([0-9]*\.[0-9]*\.[0-9]*\)/VERSION=\1/p' README.md >> $GITHUB_ENV
- run: | # install noto fonts for translated pdfs
sudo apt-get install fonts-noto fonts-noto-cjk
# - run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
# - uses: teaxyz/setup@v0
- name: Set Version - Release
if: ${{ inputs.release }}
run: echo "- \fancyfoot[L]{$VERSION}" >> metadata.yml
- name: Set Version - CI/CD
if: ${{ !inputs.release }}
run: |
date=$(date '+%Y%m%d')
echo "- \fancyfoot[L]{$VERSION+$date}" >> metadata.yml
# - run: tea make
- run: | # Use on-box make until tea/pantry revlock is resolved
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
make
- uses: actions/upload-artifact@v3
with:
name: tea.white-paper
path: |
tea.white-paper.pdf
tea.white-paper_??.pdf
# Following steps only run for upload: true
- name: AWS credentials
if: ${{ inputs.upload }}
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
- name: Bundle translations
if: ${{ inputs.upload }}
run: |
mkdir white-papers
cp tea.white-paper_??.pdf white-papers/
- name: Bundle release
if: ${{ inputs.upload && inputs.release }}
run: cp tea.white-paper.pdf white-papers/
- name: Upload to S3
if: ${{ inputs.upload }}
run: |
aws s3 sync \
./white-papers s3://www.tea.xyz/ \
--metadata-directive REPLACE \
--cache-control no-cache,must-revalidate
- name: Invalidate cache
if: ${{ inputs.upload }}
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \
--paths / /tea.white-paper*.pdf