-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (149 loc) · 5.26 KB
/
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Deploy website to S3
on:
pull_request_target:
types: [closed]
branches: [master]
jobs:
build-resume:
name: Build resume
runs-on: ubuntu-latest
if: github.event.pull_request.merged
steps:
- uses: actions/checkout@master
with:
ref: master
- name: Install latex and fonts
run: sudo apt-get install texlive-xetex fonts-arphic-gbsn00lp fonts-wqy-zenhei fonts-arphic-gkai00mp latex-cjk-all
- name: Compile English resume
run: xelatex -file-line-error -interaction=nonstopmode -recorder lucas-kjaero-zhang-resume.tex
working-directory: resume
- name: Compile Chinese resume
run: xelatex -file-line-error -interaction=nonstopmode -recorder lucas-kjaero-zhang-个人简历.tex
working-directory: resume
- uses: actions/upload-artifact@master
name: Upload English resume
with:
name: lucas-kjaero-zhang-resume.pdf
path: resume/lucas-kjaero-zhang-resume.pdf
- uses: actions/upload-artifact@master
name: Upload Chinese resume
with:
name: lucas-kjaero-zhang-resume-chinese.pdf
path: resume/lucas-kjaero-zhang-个人简历.pdf
build-frontend:
name: Build frontend
runs-on: ubuntu-latest
if: github.event.pull_request.merged
timeout-minutes: 5
steps:
- uses: actions/checkout@master
with:
ref: master
- uses: actions/[email protected]
name: Install node
with:
node-version: '12.x'
- name: Build dependencies
run: npm ci --only=production
- name: Build production bundle
env:
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_TRACKING_ID }}
CI: true
run: npm run build
- uses: actions/upload-artifact@master
name: Upload website content
with:
name: gatsby-public
path: public
deploy:
name: Deploy to S3
needs: [build-resume, build-frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@master
name: Download website content
with:
name: gatsby-public
path: public
- uses: actions/download-artifact@master
name: Download English resume
with:
name: lucas-kjaero-zhang-resume.pdf
path: public
- uses: actions/download-artifact@master
name: Download Chinese resume
with:
name: lucas-kjaero-zhang-resume-chinese.pdf
path: public
- 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-west-1
- name: Push to S3
run: aws s3 sync public s3://${{ secrets.AWS_S3_BUCKET }}/ --no-progress --delete
- name: Invalidate Cloudfront cache
run: aws cloudfront create-invalidation --distribution-id EWJC89C0ACD7D --paths /index.html /*
release:
name: Add artifacts to release
needs: [build-resume, build-frontend]
runs-on: ubuntu-latest
steps:
- uses: K-Phoen/semver-release-action@master
name: Calculate release version
id: release_version
with:
release_branch: master
release_strategy: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_version.outputs.tag }}
release_name: ${{ github.event.pull_request.title }}
- uses: actions/download-artifact@master
name: Download website content
with:
name: gatsby-public
path: public
- uses: actions/download-artifact@master
name: Download English resume
with:
name: lucas-kjaero-zhang-resume.pdf
path: public
- uses: actions/download-artifact@master
name: Download Chinese resume
with:
name: lucas-kjaero-zhang-resume-chinese.pdf
path: public
- name: Zip release
run: zip -r release.zip public
- uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release.zip
asset_name: release.zip
asset_content_type: application/zip
- uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./public/lucas-kjaero-zhang-resume.pdf
asset_name: lucas-kjaero-zhang-resume.pdf
asset_content_type: application/pdf
- uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./public/lucas-kjaero-zhang-个人简历.pdf
asset_name: lucas-kjaero-zhang-resume-zh.pdf
asset_content_type: application/pdf