Update autoscaling for cache cleaner #149
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: | |
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 }} | |