-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (69 loc) · 2.41 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
75
76
77
78
79
80
81
82
83
name: Build and Publish overpass-turbo site
on:
push:
branches:
- "main"
- "staging"
jobs:
build:
permissions:
pages: write
contents: write
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.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: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Checkout overpass-turbo repo
uses: actions/checkout@v4
with:
repository: OpenHistoricalMap/overpass-turbo
ref: ac9201e6b9a28cf6883335d4a956b3120509c972
path: overpass-turbo
- name: Enable Corepack
run: corepack enable
- name: Check directory
run: ls -la
working-directory: overpass-turbo
- name: Install dependencies
run: yarn install
working-directory: overpass-turbo
- name: Build project
run: yarn build
working-directory: overpass-turbo
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- 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 dist/ 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 }}
working-directory: overpass-turbo