Skip to content

Update script

Update script #734

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.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: f4f5a0342b3d767a535febffcf9b9a1184c19ea5
# token: ${{env.DEV_GITHUB_TOKEN}}
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install modules
run: |
rm -rf node_modules
npm cache clean --force
yarn install --no-progress --frozen-lockfile
- name: Build frontend
run: |
sed -i -e 's/overpass-api.openhistoricalmap.org/'${OVERPASS_API}'/g' js/configs.ts
yarn build
- 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 }}