Skip to content

Commit

Permalink
Update nominatim-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Feb 17, 2025
1 parent 1af7cb3 commit 44b4442
Showing 1 changed file with 22 additions and 33 deletions.
55 changes: 22 additions & 33 deletions .github/workflows/frontend-nominatim.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Build and Publish Nominatim site

on:
push:
branches:
- 'main'
- 'staging'
- 'nominatim-ui'

jobs:
nominatim:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -15,47 +19,33 @@ jobs:

- name: Set environment variables - Staging
if: github.ref == 'refs/heads/staging'
uses: allenevans/[email protected]
with:
NOMINATIM_API: https://nominatim-api.staging.openhistoricalmap.org/
NOMINATIM_BUCKET: nominatim-staging.openhistoricalmap.org
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_NOMINATIM_CLOUDFRONT_ID }}
run: |
echo "NOMINATIM_API=https://nominatim-api.staging.openhistoricalmap.org/" >> $GITHUB_ENV
echo "NOMINATIM_BUCKET=nominatim-staging.openhistoricalmap.org" >> $GITHUB_ENV
echo "CLOUDFRONT_DISTRIBUTION_ID=${{ secrets.STAGING_NOMINATIM_CLOUDFRONT_ID }}" >> $GITHUB_ENV
- name: Set environment variables - Production
if: github.ref == 'refs/heads/main'
uses: allenevans/[email protected]
with:
NOMINATIM_API: 'https://nominatim-api.openhistoricalmap.org/'
NOMINATIM_BUCKET: 'nominatim.openhistoricalmap.org'
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.PRODUCTION_NOMINATIM_CLOUDFRONT_ID }}
run: |
echo "NOMINATIM_API=https://nominatim-api.openhistoricalmap.org/" >> $GITHUB_ENV
echo "NOMINATIM_BUCKET=nominatim.openhistoricalmap.org" >> $GITHUB_ENV
echo "CLOUDFRONT_DISTRIBUTION_ID=${{ secrets.PRODUCTION_NOMINATIM_CLOUDFRONT_ID }}" >> $GITHUB_ENV
- name: Checkout nominatim-ui repo
- name: Checkout nominatim-ui repo (Specific SHA)
uses: actions/checkout@v4
with:
repository: OpenHistoricalMap/nominatim-ui
ref: 81e184d68b5bbe09a18eca79e9a73c08971bcf74
ref: c14d033389acedf4dcbaabd9d88e14bc40212279
fetch-depth: 0

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install
- name: Install dependencies
run: npm ci

- name: Build nominatim-ui frontend
run: |
Expand All @@ -67,16 +57,15 @@ jobs:
with:
python-version: '3.8'

- name: Install aws cli
- 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() }}
- name: Deploy to S3 and Invalidate CloudFront
run: |
aws s3 sync dist/ s3://${NOMINATIM_BUCKET}/
aws cloudfront create-invalidation --distribution-id=${CLOUDFRONT_DISTRIBUTION_ID} --paths=/
aws s3 sync dist/ s3://${NOMINATIM_BUCKET}/ --delete
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 }}

0 comments on commit 44b4442

Please sign in to comment.