Set new ebs for tiler - staging #1100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |