Merge pull request #301 from OpenHistoricalMap/map-style-202405 #539
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 tasking-manager site | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'staging' | |
jobs: | |
tm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.8.0 | |
with: | |
access_token: ${{ github.token }} | |
- name: Set environment variables - Staging | |
if: github.ref == 'refs/heads/staging' | |
uses: allenevans/set-env@v2.0.0 | |
with: | |
TM_APP_BASE_URL: https://tasks-staging.openhistoricalmap.org | |
TM_APP_API_URL: https://tm-api.staging.openhistoricalmap.org | |
TM_APP_API_VERSION: v2 | |
TM_ORG_NAME: OpenHistoricalMap | |
TM_ORG_CODE: OHM | |
TM_ORG_URL: openhistoricalmap.org | |
TM_ORG_PRIVACY_POLICY_URL: staging.openhistoricalmap.org/copyright | |
TM_ORG_TWITTER: http://twitter.com/OpenHistMap | |
TM_ORG_GITHUB: github.com/openhistoricalmap | |
TM_CONSUMER_KEY: ${{ secrets.STAGING_TM_API_CONSUMER_KEY }} | |
TM_CONSUMER_SECRET: ${{ secrets.STAGING_TM_API_CONSUMER_SECRET }} | |
OSM_SERVER_URL: https://staging.openhistoricalmap.org | |
OSM_REGISTER_URL: https://staging.openhistoricalmap.org/user/new | |
ID_EDITOR_URL: https://staging.openhistoricalmap.org/edit?editor=id | |
POTLATCH2_EDITOR_URL: https://staging.openhistoricalmap.org/edit?editor=potlatch2 | |
TM_MAX_AOI_AREA: 15000 | |
TM_IMPORT_MAX_FILESIZE: 3e+06 | |
AWS_S3_BUCKET: tasks-staging.openhistoricalmap.org | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_TM_CLOUDFRONT_DISTRIBUTION_ID }} | |
- name: Set environment variables - Production | |
if: github.ref == 'refs/heads/main' | |
uses: allenevans/set-env@v2.0.0 | |
with: | |
TM_APP_BASE_URL: https://tasks.openhistoricalmap.org | |
TM_APP_API_URL: https://tm-api.openhistoricalmap.org | |
TM_APP_API_VERSION: v2 | |
TM_ORG_NAME: OpenHistoricalMap | |
TM_ORG_CODE: OHM | |
TM_ORG_URL: www.openhistoricalmap.org | |
TM_ORG_PRIVACY_POLICY_URL: www.openhistoricalmap.org/copyright | |
TM_ORG_TWITTER: http://twitter.com/OpenHistMap | |
TM_ORG_GITHUB: github.com/openhistoricalmap | |
TM_CONSUMER_KEY: ${{ secrets.PRODUCTION_TM_API_CONSUMER_KEY }} | |
TM_CONSUMER_SECRET: ${{ secrets.PRODUCTION_TM_API_CONSUMER_SECRET }} | |
OSM_SERVER_URL: https://www.openhistoricalmap.org | |
OSM_REGISTER_URL: https://www.openhistoricalmap.org/user/new | |
ID_EDITOR_URL: https://www.openhistoricalmap.org/edit?editor=id | |
POTLATCH2_EDITOR_URL: https://www.openhistoricalmap.org/edit?editor=potlatch2 | |
TM_MAX_AOI_AREA: 15000 | |
TM_IMPORT_MAX_FILESIZE: 3e+06 | |
AWS_S3_BUCKET: tasks.openhistoricalmap.org | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.PRODUCTION_TM_CLOUDFRONT_DISTRIBUTION_ID }} | |
- name: Checkout tasking-manager repo | |
uses: actions/checkout@v2 | |
with: | |
repository: OpenHistoricalMap/tasking-manager | |
ref: 3902d566d9d2d8d5a9c37bf61894ed649b581ee5 | |
# token: ${{ env.DEV_GITHUB_TOKEN }} | |
- name: Use Node.js 12 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12' | |
- name: npm Install | |
run: | | |
npm install && npm run build | |
working-directory: frontend | |
- 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: Sync to S3 and clean cache in cloudfront | |
if: ${{ success() }} | |
run: | | |
aws s3 sync frontend/build s3://${AWS_S3_BUCKET} --acl public-read --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 }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |