-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (64 loc) · 2.32 KB
/
frontend-overpass.yaml
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
name: Build and Publish overpass-turbo site
on:
push:
branches:
- 'main'
- 'staging'
jobs:
overpass-turbo:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Set environment variables - Staging
if: github.ref == 'refs/heads/staging'
uses: allenevans/[email protected]
with:
OVERPASS_API: overpass-api-staging.openhistoricalmap.org
OVERPASS_BUCKET: overpass-turbo-staging.openhistoricalmap.org
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_OVERPASS_CLOUDFRONT_ID }}
- name: Set environment variables - Production
if: github.ref == 'refs/heads/main'
uses: allenevans/[email protected]
with:
OVERPASS_API: overpass-api.openhistoricalmap.org
OVERPASS_BUCKET: overpass-turbo.openhistoricalmap.org
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.PRODUCTION_OVERPASS_CLOUDFRONT_ID }}
- name: Checkout overpass-turbo repo
uses: actions/checkout@v2
with:
repository: OpenHistoricalMap/overpass-turbo
ref: 43d1d9aa7e8bbb7152c89354900fdd327f9f7ffe
# token: ${{env.DEV_GITHUB_TOKEN}}
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install modules
run: |
rm -rf node_modules
rm package-lock.json
npm cache clean --force
npm cache verify
npm install
- name: Build frontend
run: |
sed -i -e 's/overpass-api.openhistoricalmap.org/'${OVERPASS_API}'/g' js/configs.js
npm run build
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install aws cli
run: |
python -m pip install --upgrade pip
pip install awscli
- name: Push data to s3 and clean cloudfront cache
if: ${{ success() }}
run: |
aws s3 sync build/ s3://${OVERPASS_BUCKET}/
aws cloudfront create-invalidation --distribution-id=${CLOUDFRONT_DISTRIBUTION_ID} --paths=/
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}